Skip to content

@emile/engine


@emile/engine / matter / TypedBody

Interface: TypedBody ​

Defined in: src/matter.d.ts:4

Extends ​

  • Body

Properties ​

angle ​

angle: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:722

A Number specifying the angle of the body, in radians.

Default ​

ts
0

Inherited from ​

Matter.Body.angle


angularSpeed ​

readonly angularSpeed: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:729

A Number that measures the current angular speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.angularVelocity).

Read Only ​

Default ​

ts
0

Inherited from ​

Matter.Body.angularSpeed


angularVelocity ​

readonly angularVelocity: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:737

A Number that measures the current angular velocity of the body after the last Body.update. It is read-only. If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's angle (as the engine uses position-Verlet integration).

Read Only ​

Default ​

ts
0

Inherited from ​

Matter.Body.angularVelocity


area ​

area: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:743

A Number that measures the area of the body's convex hull, calculated at creation by Body.create.

Default ​

ts

Inherited from ​

Matter.Body.area


axes ​

axes: Vector[]

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:749

An array of unique axis vectors (edge normals) used for collision detection. These are automatically calculated from the given convex hull (vertices array) in Body.create. They are constantly updated by Body.update during the simulation.

Inherited from ​

Matter.Body.axes


bounds ​

bounds: Bounds

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:754

A Bounds object that defines the AABB region for the body. It is automatically calculated from the given convex hull (vertices array) in Body.create and constantly updated by Body.update during simulation.

Inherited from ​

Matter.Body.bounds


circleRadius? ​

optional circleRadius: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:761

A Number that is set to the radius of the object if the body was constructed using Bodies.circle. May have a value of null if the body is no longer a circle (i.e. was scaled with a scaleX != scaleY).

Default ​

ts
0

Inherited from ​

Matter.Body.circleRadius


collisionFilter ​

collisionFilter: ICollisionFilter

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:991

An Object that specifies the collision filtering properties of this body.

Collisions between two bodies will obey the following rules:

  • If the two bodies have the same non-zero value of collisionFilter.group, they will always collide if the value is positive, and they will never collide if the value is negative.
  • If the two bodies have different values of collisionFilter.group or if one (or both) of the bodies has a value of 0, then the category/mask rules apply as follows:

Each body belongs to a collision category, given by collisionFilter.category. This value is used as a bit field and the category should have only one bit set, meaning that the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 different collision categories available.

Each body also defines a collision bitmask, given by collisionFilter.mask which specifies the categories it collides with (the value is the bitwise AND value of all these categories).

Using the category/mask rules, two bodies A and B collide if each includes the other's category in its mask, i.e. (categoryA & maskB) !== 0 and (categoryB & maskA) !== 0 are both true.

Inherited from ​

Matter.Body.collisionFilter


density ​

density: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:769

A Number that defines the density of the body, that is its mass per unit area. If you pass the density via Body.create the mass property is automatically calculated for you based on the size (area) of the object. This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood).

Default ​

ts
0.001

Inherited from ​

Matter.Body.density


force ​

force: Vector

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:775

A Vector that specifies the force to apply in the current step. It is zeroed after every Body.update. See also Body.applyForce.

Default ​

ts
{ x: 0, y: 0 }

Inherited from ​

Matter.Body.force


friction ​

friction: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:790

A Number that defines the friction of the body. The value is always positive and is in the range (0, 1). A value of 0 means that the body may slide indefinitely. A value of 1 means the body may come to a stop almost instantly after a force is applied.

The effects of the value may be non-linear. High values may be unstable depending on the body. The engine uses a Coulomb friction model including static and kinetic friction. Note that collision response is based on pairs of bodies, and that friction values are combined with the following formula:

Math.min(bodyA.friction, bodyB.friction)

Default ​

ts
0.1

Inherited from ​

Matter.Body.friction


frictionAir ​

frictionAir: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:799

A Number that defines the air friction of the body (air resistance). A value of 0 means the body will never slow as it moves through space. The higher the value, the faster a body slows when moving through space. The effects of the value are non-linear.

Default ​

ts
0.01

Inherited from ​

Matter.Body.frictionAir


frictionStatic ​

frictionStatic: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:968

A Number that defines the static friction of the body (in the Coulomb friction model). A value of 0 means the body will never 'stick' when it is nearly stationary and only dynamic friction is used. The higher the value (e.g. 10), the more force it will take to initially get the body moving when nearly stationary. This value is multiplied with the friction property to make it easier to change friction and maintain an appropriate amount of static friction.

Default ​

ts
0.5

Inherited from ​

Matter.Body.frictionStatic


id ​

id: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:803

An integer Number uniquely identifying number generated in Body.create by Common.nextId.

Inherited from ​

Matter.Body.id


inertia ​

inertia: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:809

A Number that defines the moment of inertia (i.e. second moment of area) of the body. It is automatically calculated from the given convex hull (vertices array) and density in Body.create. If you modify this value, you must also modify the body.inverseInertia property (1 / inertia).

Inherited from ​

Matter.Body.inertia


inverseInertia ​

inverseInertia: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:814

A Number that defines the inverse moment of inertia of the body (1 / inertia). If you modify this value, you must also modify the body.inertia property.

Inherited from ​

Matter.Body.inverseInertia


inverseMass ​

inverseMass: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:819

A Number that defines the inverse mass of the body (1 / mass). If you modify this value, you must also modify the body.mass property.

Inherited from ​

Matter.Body.inverseMass


isSensor ​

isSensor: boolean

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:839

A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically.

Default ​

ts
false

Inherited from ​

Matter.Body.isSensor


isSleeping ​

isSleeping: boolean

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:826

A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. If you need to set a body as sleeping, you should use Sleeping.set as this requires more than just setting this flag.

Default ​

ts
false

Inherited from ​

Matter.Body.isSleeping


isStatic ​

isStatic: boolean

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:833

A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. If you need to set a body as static after its creation, you should use Body.setStatic as this requires more than just setting this flag.

Default ​

ts
false

Inherited from ​

Matter.Body.isStatic


label ​

label: string

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:846

An arbitrary String name to help the user identify and manage bodies.

Default ​

ts
"Body"

Inherited from ​

Matter.Body.label


mass ​

mass: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:851

A Number that defines the mass of the body, although it may be more appropriate to specify the density property instead. If you modify this value, you must also modify the body.inverseMass property (1 / mass).

Inherited from ​

Matter.Body.mass


motion ​

readonly motion: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:859

A Number that measures the amount of movement a body currently has (a combination of speed and angularSpeed). It is read-only and always positive. It is used and updated by the Matter.Sleeping module during simulation to decide if a body has come to rest.

Read Only ​

Default ​

ts
0

Inherited from ​

Matter.Body.motion


parent ​

parent: Body

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:955

A self reference if the body is not a part of another body. Otherwise this is a reference to the body that this is a part of. See body.parts.

Inherited from ​

Matter.Body.parent


parts ​

parts: Body[]

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:949

An array of bodies that make up this body. The first body in the array must always be a self reference to the current body instance. All bodies in the parts array together form a single rigid compound body. Parts are allowed to overlap, have gaps or holes or even form concave bodies. Parts themselves should never be added to a World, only the parent body should be. Use Body.setParts when setting parts to ensure correct updates of all properties.

Inherited from ​

Matter.Body.parts


plugin ​

plugin: null | { bodyScale: Vec2; circleRadius: number; colliderType: ColliderType; entity: string; gravityScale: number; polygonVertices: Vec2[]; rectangleHeight: number; rectangleWidth: number; }

Defined in: src/matter.d.ts:5

An object reserved for storing plugin-specific properties.

Overrides ​

Matter.Body.plugin


position ​

position: Vector

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:865

A Vector that specifies the current world-space position of the body.

Default ​

ts
{ x: 0, y: 0 }

Inherited from ​

Matter.Body.position


render ​

render: IBodyRenderOptions

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:869

An Object that defines the rendering properties to be consumed by the module Matter.Render.

Inherited from ​

Matter.Body.render


restitution ​

restitution: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:880

A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula:

Math.max(bodyA.restitution, bodyB.restitution)

Default ​

ts
0

Inherited from ​

Matter.Body.restitution


sleepThreshold ​

sleepThreshold: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:886

A Number that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the Matter.Sleeping module (if sleeping is enabled by the engine).

Default ​

ts
60

Inherited from ​

Matter.Body.sleepThreshold


slop ​

slop: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:894

A Number that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. Avoid changing this value unless you understand the purpose of slop in physics engines. The default should generally suffice, although very large bodies may require larger values for stable stacking.

Default ​

ts
0.05

Inherited from ​

Matter.Body.slop


speed ​

readonly speed: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:901

A Number that measures the current speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.velocity).

Read Only ​

Default ​

ts
0

Inherited from ​

Matter.Body.speed


timeScale ​

timeScale: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:907

A Number that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed.

Default ​

ts
1

Inherited from ​

Matter.Body.timeScale


torque ​

torque: number

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:913

A Number that specifies the torque (turning force) to apply in the current step. It is zeroed after every Body.update.

Default ​

ts
0

Inherited from ​

Matter.Body.torque


type ​

type: string

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:919

A String denoting the type of object.

Default ​

ts
"body"

Inherited from ​

Matter.Body.type


velocity ​

readonly velocity: Vector

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:927

A Vector that measures the current velocity of the body after the last Body.update. It is read-only. If you need to modify a body's velocity directly, you should either apply a force or simply change the body's position (as the engine uses position-Verlet integration).

Read Only ​

Default ​

ts
{ x: 0, y: 0 }

Inherited from ​

Matter.Body.velocity


vertices ​

vertices: Vector[]

Defined in: node_modules/.pnpm/@types+matter-js@0.19.7/node_modules/@types/matter-js/index.d.ts:940

An array of Vector objects that specify the convex hull of the rigid body. These should be provided about the origin (0, 0). E.g.

[{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }]

When passed via Body.create, the vertices are translated relative to body.position (i.e. world-space, and constantly updated by Body.update during simulation). The Vector objects are also augmented with additional properties required for efficient collision detection.

Other properties such as inertia and bounds are automatically calculated from the passed vertices (unless provided via options). Concave hulls are not currently supported. The module Matter.Vertices contains useful methods for working with vertices.

Inherited from ​

Matter.Body.vertices