ArcadePhysics

 

Props

NameTypeDefaultDescription
acceleration
number

Sets the Body’s X and Y acceleration in pixels per second squared

accelerationX
number

Sets the Body’s horizontal acceleration in pixels per second squared

accelerationY
number

Sets the Body’s vertical acceleration in pixels per second squared

allowDrag
boolean

Enables or disables drag.

allowGravity
boolean

Enables or disables gravity’s effect on this Body.

angularAcceleration
number

The Body’s angular acceleration (change in angular velocity), in degrees per second squared.

angularDrag
number

Loss of angular velocity due to angular movement, in degrees per second.

Angular drag is applied only when angular acceleration is zero.

angularVelocity
number

The rate of change of this Body’s rotation, in degrees per second.

bounce
number

Sets the Body’s X and Y bounce.

bounceX
number

Sets the Body’s horizontal bounce.

bounceY
number

Sets the Body’s vertical bounce.

circle
{ radius: number; offsetX?: number; offsetY?: number; }

Sizes and positions this Body, as a circle.

damping
number

If this Body is using drag for deceleration this property controls how the drag is applied. If set to true drag will use a damping effect rather than a linear approach. If you are creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in the game Asteroids) then you will get a far smoother and more visually correct deceleration by using damping, avoiding the axis-drift that is prone with linear deceleration.

If you enable this property then you should use far smaller drag values than with linear, as they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately.

debugBodyColor
number

 

debugShowBody
boolean

 

debugShowVelocity
boolean

 

disableBody
boolean

 

drag
number

Sets the Body’s X and Y drag in pixels per second squared

dragX
number

Sets the Body’s horizontal drag in pixels per second squared

dragY
number

Sets the Body’s vertical drag in pixels per second squared

friction
number

Sets the Body’s X and Y friction.

frictionX
number

Sets the Body’s horizontal friction.

frictionY
number

Sets the Body’s vertical friction.

gravity
number

Sets the Body’s X and Y gravity in pixels per second squared

gravityX
number

Sets the Body’s horizontal gravity in pixels per second squared

gravityY
number

Sets the Body’s vertical gravity in pixels per second squared

immovable
boolean

Whether this Body can be moved by collisions with another Body.

mass
number

Sets the Mass of the StaticBody. Will set the Mass to 0.1 if the value passed is less than or equal to zero.

maxVelocity
number

Sets the Body’s X and Y maximum velocity

maxVelocityX
number

Sets the Body’s horizontal maximum velocity

maxVelocityY
number

Sets the Body’s vertical maximum velocity

offset
XY

Sets the body offset. This allows you to adjust the difference between the center of the body and the x and y coordinates of the parent Game Object.

size
{ width: number; height: number; center?: boolean; }

Sizes and positions this Body, as a rectangle. Modifies the Body offset if center is true (the default). Resets the width and height to match current frame, if no width and height provided and a frame is found.

static
boolean

 

velocity
number

Sets the Body’s X and Y velocity in pixels per second

velocityX
number

Sets the Body’s horizontal velocity in pixels per second

velocityY
number

Sets the Body’s vertical velocity in pixels per second