QuickObject
Kind of class: | public class |
---|---|
Package: | com.actionsnippet.qbox |
Inherits from: | none |
Known subclasses: | |
Version: | 1.1 |
Author: | Zevan Rosser |
Classpath: | com.actionsnippet.qbox.QuickObject |
File last modified: | Saturday, 07 November 2009, 12:25:27 |
The QuickObject class wraps nearly all the Box2D classes neccessary for rigid body instantiation - such as b2BodyDef, b2Body, b2Shape and b2DistanceJointDef. The QuickObject class also wraps a few properties of b2Body to enable easy alteration of position and rotation.
There is no need to instantiate a QuickObject directly. You should use the QuickBox2D add methods:
QuickBox2D.addBox
QuickBox2D.addCircle
QuickBox2D.addPoly
QuickBox2D.addGroup
QuickBox2D.addJoint
There is no need to instantiate a QuickObject directly. You should use the QuickBox2D add methods:
QuickBox2D.addBox
QuickBox2D.addCircle
QuickBox2D.addPoly
QuickBox2D.addGroup
QuickBox2D.addJoint
Summary
Instance properties
- bodyDef : b2BodyDef
- The b2BodyDef for this QuickObject.
- body : b2Body
- The b2Body for this QuickObject.
- shape
- shapeDef
- joint : b2Joint
- The b2DistanceJoint if this QuickObject is a JointObject.
- params : Object
- userData : *
- The userData property from the b2Body or b2Joint.
- x (val:Number) : Number
- The x location of the rigid body.
- y (val:Number) : Number
- The y location of the rigid body.
- angle (val:Number) : Number
- The angle of the rigid body.
Instance methods
- setLoc (x:Number, y:Number) : void
- Sets the x and y location of the rigid body.
- handCursor : void
- destroy : void
- Destroys all composed Box2D instances (b2Shape, b2Body, b2Joint) and removes the DisplayObject associated with this QuickObject instance (if there is one).
Instance properties
angle
public angle:Number
(read,write)
The angle of the rigid body.
body
public body:b2Body
(read,write)
The b2Body for this QuickObject. This property is important as it gives access to all b2Body methods such as
ApplyImpulse()
and ApplyForce()
. bodyDef
public bodyDef:b2BodyDef
(read,write)
The b2BodyDef for this QuickObject.
joint
public joint:b2Joint
(read,write)
The b2DistanceJoint if this QuickObject is a JointObject.
params
public params:Object
(read,write)
shape
public shape = *
(read,write)
The b2Shape for this QuickObject. This property is dynamic - it is either an Array of b2Shape objects or a single b2Shape. For group objects this will be an array, for all other QuickObjects (including polygons) it will be a single b2ShapeDef.
shapeDef
public shapeDef = *
(read,write)
The b2ShapeDef for this QuickObject. This property is dynamic - it is either an Array of b2ShapeDef objects or a single b2ShapeDef. For polygons and groups this will be an array, for all other QuickObjects it will be a single b2ShapeDef.
userData
public userData:*
(read,write)
The userData property from the b2Body or b2Joint. This will usually be a DisplayObject populated by QuickBox2D.
x
public x:Number
(read,write)
The x location of the rigid body.
y
public y:Number
(read,write)
The y location of the rigid body.
Instance methods
destroy
final public function destroy (
) : void
Destroys all composed Box2D instances (b2Shape, b2Body, b2Joint) and removes the DisplayObject associated with this QuickObject instance (if there is one). QuickObjects will only truly be destroyed at the end of the QuickBox2D internal loop - allowing for you to call this method inside of contact event listener functions.
handCursor
internal public function handCursor (
) : void
setLoc
public function setLoc (
x:Number,
y:Number) : void
Sets the x and y location of the rigid body.
Parameters:
x:
The x location.
y:
The y location.