API Docs for: 0.7.1
Show:

Plane Class

Extends Shape
Defined in: src/shapes/Plane.js:7

Plane shape class. The plane is facing in the Y direction.

Constructor

Plane

(
  • [options]
)

Parameters:

  • [options] Object optional

    (Note that this options object will be passed on to the Shape constructor.)

Methods

computeAABB

(
  • out
  • position
  • angle
)

Inherited from Shape but overwritten in src/shapes/Plane.js:38

Parameters:

  • out AABB
  • position Array
  • angle Number

computeMomentOfInertia

()

Inherited from Shape but overwritten in src/shapes/Plane.js:22

Compute moment of inertia

raycast

(
  • result
  • ray
  • position
  • angle
)

Inherited from Shape but overwritten in src/shapes/Plane.js:95

Parameters:

  • result RayResult
  • ray Ray
  • position Array
  • angle Number

updateArea

()

Inherited from Shape: src/shapes/Shape.js:215

Update the .area property of the shape.

updateBoundingRadius

()

Inherited from Shape but overwritten in src/shapes/Plane.js:30

Update the bounding radius

Properties

angle

Number

Inherited from Shape: src/shapes/Shape.js:36

Body-local angle of the shape.

area

Number

Inherited from Shape: src/shapes/Shape.js:123

Area of this shape.

body

Body

Inherited from Shape: src/shapes/Shape.js:21

The body this shape is attached to. A shape can only be attached to a single body.

boundingRadius

Number

Inherited from Shape: src/shapes/Shape.js:65

Bounding circle radius of this shape

collisionGroup

Number

Inherited from Shape: src/shapes/Shape.js:72

Collision group that this shape belongs to (bit mask). See this tutorial.

Example:

// Setup bits for each available group
                    var PLAYER = Math.pow(2,0),
                        ENEMY =  Math.pow(2,1),
                        GROUND = Math.pow(2,2)
                    
                    // Put shapes into their groups
                    player1Shape.collisionGroup = PLAYER;
                    player2Shape.collisionGroup = PLAYER;
                    enemyShape  .collisionGroup = ENEMY;
                    groundShape .collisionGroup = GROUND;
                    
                    // Assign groups that each shape collide with.
                    // Note that the players can collide with ground and enemies, but not with other players.
                    player1Shape.collisionMask = ENEMY | GROUND;
                    player2Shape.collisionMask = ENEMY | GROUND;
                    enemyShape  .collisionMask = PLAYER | GROUND;
                    groundShape .collisionMask = PLAYER | ENEMY;
                    
// How collision check is done
                    if(shapeA.collisionGroup & shapeB.collisionMask)!=0 && (shapeB.collisionGroup & shapeA.collisionMask)!=0){
                        // The shapes will collide
                    }
                    

collisionMask

Number

Inherited from Shape: src/shapes/Shape.js:109

Collision mask of this shape. See .collisionGroup.

collisionResponse

Boolean

Inherited from Shape: src/shapes/Shape.js:103

Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled. That means that this shape will move through other body shapes, but it will still trigger contact events, etc.

id

Number

Inherited from Shape: src/shapes/Shape.js:58

Shape object identifier.

material

Material

Inherited from Shape: src/shapes/Shape.js:116

Material to use in collisions for this Shape. If this is set to null, the world will use default material properties instead.

position

Array

Inherited from Shape: src/shapes/Shape.js:27

Body-local position of the shape.

sensor

Boolean

Inherited from Shape: src/shapes/Shape.js:130

Set to true if you want this shape to be a sensor. A sensor does not generate contacts, but it still reports contact events. This is good if you want to know if a shape is overlapping another shape, without them generating contacts.