Skip to content

1681-engine / index / BodyOptions

Interface: BodyOptions ​

Defined in: src/physics/types.ts:43

Properties ​

angle? ​

ts
optional angle?: number;

Defined in: src/physics/types.ts:56

Radians, clockwise on screen (y grows downwards).


angularDamping? ​

ts
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? ​

ts
optional angularVelocity?: number;

Defined in: src/physics/types.ts:58

Radians per second.


friction? ​

ts
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? ​

ts
optional gravityScale?: number;

Defined in: src/physics/types.ts:70

Multiplies the world's gravity for this body (default 1; 0 floats).


layer? ​

ts
optional layer?: number;

Defined in: src/physics/types.ts:74

Category bits this body is in (default 1).


linearDamping? ​

ts
optional linearDamping?: number;

Defined in: src/physics/types.ts:68

Velocity lost per second, as a share (default 0): air drag.


mask? ​

ts
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? ​

ts
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? ​

ts
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? ​

ts
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? ​

ts
optional sensor?: boolean;

Defined in: src/physics/types.ts:72

A sensor reports overlaps (contact events) but is never pushed and pushes nothing.


shape ​

ts
shape: Shape;

Defined in: src/physics/types.ts:45


type? ​

ts
optional type?: BodyType;

Defined in: src/physics/types.ts:44


userData? ​

ts
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? ​

ts
optional vx?: number;

Defined in: src/physics/types.ts:48


vy? ​

ts
optional vy?: number;

Defined in: src/physics/types.ts:49


x? ​

ts
optional x?: number;

Defined in: src/physics/types.ts:46


y? ​

ts
optional y?: number;

Defined in: src/physics/types.ts:47

Released under the MIT License.