Body-local angle of the shape.
Area of this shape.
The body this shape is attached to. A shape can only be attached to a single body.
Bounding circle radius of this shape
Collision group that this shape belongs to (bit mask). See this tutorial.
// 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
}
Collision mask of this shape. See .collisionGroup.
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.
Shape object identifier
Material to use in collisions for this Shape. If this is set to null, the world will use default material properties instead.
Body-local position of the shape.
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.
The type of the shape. One of:
Static
BOXBox shape type
Static
CAPSULECapsule shape type
Static
CIRCLECircle shape type
Static
CONVEXConvex shape type
Static
HEIGHTFIELDHeightfield shape type
Static
LINELine shape type
Static
PARTICLEParticle shape type
Static
PLANEPlane shape type
Static
idID counter for shapes
Should return the moment of inertia around the Z axis of the body. See Wikipedia's list of moments of inertia.
If the inertia is infinity or if the object simply isn't possible to rotate, return 0.
Test if a point is inside this shape.
whether a point is inside this shape
Perform raycasting on this shape.
Plane shape class. The plane is facing in the Y direction.
Example