API Docs for: 1.13.1
Show:

game.Body Class

Extends game.Class
Module: physics

Physics body.

Constructor

game.Body

(
  • [properties]
)

Parameters:

  • [properties] Object optional

Methods

addShape

(
  • shape
)

Add shape to body.

Parameters:

  • shape game.Shape

addTo

(
  • world
)

Add body to world.

Parameters:

afterCollide

(
  • bodyB
)

This is called after hit response.

Parameters:

  • bodyB game.Body

    body that it collided with.

collide

(
  • body
)
Boolean

This is called, when body collides with another body.

Parameters:

Returns:

Boolean:

Return true, to apply hit response.

remove

()

Remove body from it's world.

removeCollision

()

Remove collision from body.

setCollideAgainst

(
  • groups
)

Set body's collideAgainst groups.

Parameters:

  • groups Number

setCollisionGroup

(
  • group
)

Set new collision group for body.

Parameters:

  • group Number

update

()

Properties

collideAgainst

Array

Group numbers that body collides against.

Default: []

collisionGroup

Number

Body's collision group.

Default: null

damping

Number

Body's damping. Should be number between 0 and 1.

Default: 0

force

game.Vector

Body's force.

Default: 0,0

last

game.Vector

Last position of body.

mass

Number

Body's mass.

Default: 0

position

game.Vector

Position of body.

shape

game.Shape

Body's shape.

velocity

game.Vector

Body's velocity.

velocityLimit

game.Vector

Body's maximum velocity.

Default: 0,0

world

game.World

Body's physic world.