1681-engine / index / BodyOptions
Interface: BodyOptions ​
Defined in: src/physics/types.ts:43
Properties ​
angle? ​
optional angle?: number;Defined in: src/physics/types.ts:56
Radians, clockwise on screen (y grows downwards).
angularDamping? ​
optional angularDamping?: number;Defined in: src/physics/types.ts:60
Turning lost per second, as a share (default 0.05): a rolling ball slows down without rolling friction.
angularVelocity? ​
optional angularVelocity?: number;Defined in: src/physics/types.ts:58
Radians per second.
friction? ​
optional friction?: number;Defined in: src/physics/types.ts:66
Coulomb friction coefficient (default 0.5). A pair uses the geometric mean of its two.
gravityScale? ​
optional gravityScale?: number;Defined in: src/physics/types.ts:70
Multiplies the world's gravity for this body (default 1; 0 floats).
layer? ​
optional layer?: number;Defined in: src/physics/types.ts:74
Category bits this body is in (default 1).
linearDamping? ​
optional linearDamping?: number;Defined in: src/physics/types.ts:68
Velocity lost per second, as a share (default 0): air drag.
mask? ​
optional mask?: number;Defined in: src/physics/types.ts:76
Category bits this body collides with (default all). A pair collides when each one's layer is in the other's mask.
mass? ​
optional mass?: number;Defined in: src/physics/types.ts:62
Mass of a dynamic body (default 1). Ignored for static and kinematic bodies, whose mass is infinite.
restitution? ​
optional restitution?: number;Defined in: src/physics/types.ts:64
Bounce, 0–1 (default 0). A pair bounces by the larger of its two.
rotates? ​
optional rotates?: boolean;Defined in: src/physics/types.ts:54
Whether contacts and torques turn the body (default false). A body that does not rotate may still be placed at an angle, and keeps it.
sensor? ​
optional sensor?: boolean;Defined in: src/physics/types.ts:72
A sensor reports overlaps (contact events) but is never pushed and pushes nothing.
shape ​
shape: Shape;Defined in: src/physics/types.ts:45
type? ​
optional type?: BodyType;Defined in: src/physics/types.ts:44
userData? ​
optional userData?: unknown;Defined in: src/physics/types.ts:78
Anything the game wants to find again from a contact or a ray hit (an entity id, an object).
vx? ​
optional vx?: number;Defined in: src/physics/types.ts:48
vy? ​
optional vy?: number;Defined in: src/physics/types.ts:49
x? ​
optional x?: number;Defined in: src/physics/types.ts:46
y? ​
optional y?: number;Defined in: src/physics/types.ts:47