Skip to content

eulerjs API / @eulerjs/core / ObjectBodyOptions

ObjectBodyOptions ​

Defined in: packages/core/src/Body.ts:57

Options for a body made from a three.js object, which supplies its shape and starting pose.

Extends ​

  • Omit<BodyOptions, "object" | "massProperties" | "mass" | "density" | "voxels" | "colliders">

Properties ​

PropertyTypeDescriptionInherited fromDefined in
angularDamping?numberFraction of angular velocity lost per second, applied as w *= exp(-angularDamping * dt).BodyOptions.angularDampingpackages/core/src/Body.ts:37
angularVelocity?Vector3Angular velocity in world space, in rad/s.BodyOptions.angularVelocitypackages/core/src/Body.ts:33
canSleep?booleanWhether the body may fall asleep once it has been still for a while. Defaults to true.BodyOptions.canSleeppackages/core/src/Body.ts:53
cellSize?numberCell size for shape: 'voxels', in metres. Defaults to a sixteenth of the longest side.-packages/core/src/Body.ts:70
collider?| Collider | ColliderShorthand | readonly Collider[]What the body collides as: a shape fitted around the object's meshes, 'box', 'sphere', 'convex' (their hull), or 'cylinder', 'cone' or 'capsule' standing along their y axis; or your own collider instances. Without meshes, the colliders also give the body its mass properties. There is no default: without collider the body collides with nothing. That is intended. The mass always comes from the meshes, but the mesh drawn is seldom the shape to collide as (too detailed, or not convex), so which one is your choice.-packages/core/src/Body.ts:80
density?numberIn kg/m³. Defaults to water, 1000, when no mass is given either.-packages/core/src/Body.ts:61
gravityScale?numberMultiplier on the world's gravity for this body; 0 turns gravity off.BodyOptions.gravityScalepackages/core/src/Body.ts:39
instance?BodyInstanceOne instance of a three.js InstancedMesh that follows the body, as object does: for many bodies that look alike drawn in one go. Its starting pose, and the scale it keeps, are read from the instance's matrix. world.addInstances makes a body for every instance of a mesh.BodyOptions.instancepackages/core/src/Body.ts:47
linearDamping?numberFraction of linear velocity lost per second, applied as v *= exp(-linearDamping * dt).BodyOptions.linearDampingpackages/core/src/Body.ts:35
mass?numberTotal mass in kg. Give this or density.-packages/core/src/Body.ts:59
position?Vector3Origin of the body frame in world space. Defaults to the bound object's world position.BodyOptions.positionpackages/core/src/Body.ts:27
quaternion?QuaternionOrientation of the body frame. Defaults to the bound object's world orientation.BodyOptions.quaternionpackages/core/src/Body.ts:29
shape?"voxels" | "mesh"How to get the mass properties from the object's meshes: mesh integrates the closed surface exactly (the default); voxels fills it with cells, which also works for open meshes such as a hull with no deck, and keeps the cells for buoyancy. With mesh, a mesh that isn't closed is weighed by its colliders instead, if it has solid ones.-packages/core/src/Body.ts:68
type?BodyType-BodyOptions.typepackages/core/src/Body.ts:16
velocity?Vector3Velocity of the centre of mass, in m/s.BodyOptions.velocitypackages/core/src/Body.ts:31

Released under the MIT License.