Interface PhysicsBodyOption

interface PhysicsBodyOption {
    allowSleep?: boolean;
    angularDamping?: number;
    angularFactor?: Vec3;
    angularVelocity?: Vec3;
    collisionFilterGroup?: number;
    collisionFilterMask?: number;
    collisionResponse?: boolean;
    fixedRotation?: boolean;
    isTrigger?: boolean;
    linearDamping?: number;
    linearFactor?: Vec3;
    mass?: number;
    material?: Material;
    position?: Vec3;
    quaternion?: Quaternion;
    shape?: Shape;
    sleepSpeedLimit?: number;
    sleepTimeLimit?: number;
    type?: BodyType;
    velocity?: Vec3;
}

Properties

allowSleep?: boolean

If true, the body will automatically fall to sleep.

Default

true
angularDamping?: number

How much to damp the body angular velocity each step. It can go from 0 to 1.

Default

0.01
angularFactor?: Vec3

Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none.

angularVelocity?: Vec3

Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates.

collisionFilterGroup?: number

The collision group the body belongs to.

Default

1
collisionFilterMask?: number

The collision group the body can collide with.

Default

-1
collisionResponse?: boolean

Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered.

fixedRotation?: boolean

Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation.

Default

false
isTrigger?: boolean

When true the body behaves like a trigger. It does not collide with other bodies but collision events are still triggered.

Default

false
linearDamping?: number

How much to damp the body velocity each step. It can go from 0 to 1.

Default

0.01
linearFactor?: Vec3

Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none.

mass?: number

The mass of the body.

Default

0
material?: Material

The physics material of the body. It defines the body interaction with other bodies.

position?: Vec3

World space position of the body.

quaternion?: Quaternion

World space orientation of the body.

shape?: Shape

Add a Shape to the body.

sleepSpeedLimit?: number

If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy.

Default

0.1
sleepTimeLimit?: number

If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping.

Default

1
type?: BodyType

One of: Body.DYNAMIC, Body.STATIC and Body.KINEMATIC.

velocity?: Vec3

World space velocity of the body.