CG.B2DChainShape Class
B2DChainShape
var e = new CG.B2DChainShape({
name: 'player',
points: [new CG.Point(10,10), new CG.Point(300,50), new CG.Point(450,10)],
x: 100,
y: 100,
world: b2world,
scale: 40
})
Item Index
Methods
Properties
- allowSleep
- alpha
- angle
- awake
- body
- bodyDef
- bodyDef.alowSleep
- bodyDef.angle
- bodyDef.awake
- bodyDef.bullet
- bodyDef.fixedRotation
- bodyDef.position
- bodyDef.type
- bodyDef.userData
- bodyType
- boundingradius
- bullet
- categoryBits
- clicked
- dead
- density
- dragable
- fixDef
- fixDef.density
- fixDef.filter.categoryBits
- fixDef.filter.groupIndex
- fixDef.filter.maskBits
- fixDef.friction
- fixDef.restitution
- fixDef.shape
- fixedRotation
- friction
- groupIndex
- height
- hover
- id
- isHit
- mapcollision
- maskBits
- polys
- restitution
- rotation
- scale
- strength
- transform
- visible
- width
- world
- x
- xhandle
- xscale
- y
- yhandle
- yscale
Methods
AABB
()
Object
returns the bounds of rotated rectangle
Returns:
returns the calculated bounds
checkCollision
-
objects
-
callback
checks if there is a collision of the given objects to this object http://devmag.org.za/2009/04/13/basic-collision-detection-in-2d-part-1/
Parameters:
-
objects
Arraya array of objects to check for collision => Sprites, Animations, MapAreas
-
callback
Callbackwhat to do after collision?
convertRealWorldPointToBox2DVec2
-
vertices
convertRealWorldPointToBox2DVec2 converts real world vectors to box2d world vecs depending on scale
Parameters:
-
vertices
ArrayCG.Point array
Returns:
vecs b2Vec2 with box2d world scale
getPosition
()
ifClicked
()
True/false
checks click inside of the rectangle, supports rotation
Returns:
ifMouseOver
()
checks if the mouse/pointer is over the rectangle
init
-
options
Options: name {string} points {array} x {number} y (number} world {object} scale {number}
Parameters:
-
options
Object
Returns:
setImage
-
image
initialize image for object. for now => sprite, particle, buffer, bitmap and button use it
Parameters:
-
image
Imageimage path, image or atlasimage
Properties
body
B2Body
bodyDef
B2BodyDef
bodyDef.position
Unknown
bodyDef.type
box2d.b2BodyType.b2_staticBody/box2d.b2BodyType.b2_dynamicBody/box2d.b2BodyType.b2_kinematicBody/box2d.b2BodyType.b2_bulletBody
bodyDef.userData
bodyType
box2d.b2BodyType
bullet
B2Body
fixDef
B2FixtureDef
fixDef.shape
B2CircleShape
scale
transform
Transform
Transform object for matrix transformation