Classes


Class PhysicsObject

Class Summary
Constructor Attributes Constructor Name and Description
 
PhysicsObject is a behavior to be used with WADE, and is part of the wade.physics plug-in.
Field Summary
Field Attributes Field Name and Description
 
Whether the physics object is active.
 
Whether this object should be allowed to sleep.
 
The amount of damping (reduction in velocity) that is caused by angular motion.
 
The type of physics body.
 
Whether the object is a bullet (a fast-moving object), which implies that it needs continuous collision detection to avoid going throug object
 
Whether this object should only translate and never rotate.
 
A number to multiply the effect of gravity on this body.
 
The amount of damping (reduction in velocity) that is caused by linear motion.
Method Summary
Method Attributes Method Name and Description
 
addFixture(fData)
Add a fixture to the physics body.
 
addMouseJoint(offset)
Add a mouse joint.
 
applyForce(force, power, offset)
applyForce Apply a force to a box2d body As this uses a normalized vector, do not convert the force using wadeToBox.
 
applyImpulse(impulse, power, offset)
applyImpulse Apply an impulse to a box2d body As this uses a normalized vector, do not convert the impulse using wadeToBox.
 
applyTorque(torque)
applyTorque Apply a torque to the body in newton-meters Affects the angular velocity but not the linear velocity
 
draw_(color, originalDraw)
Get a debug draw function that shows the physics object using vector graphics.
 
Get a list of fixtures attached to this object
 
Get a list of joints attached to this object
 
Check whether the physics object is awake or not.
 
removeFixture(fixture)
removeFixture Remove a fixture
 
Remove a mouse joint from this object
 
setAwake(value)
Set a physics object as awake or not.
 
updateMouseJoint(joint, pos)
Update the position of the target point for a mouse joint
Class Detail
PhysicsObject()
PhysicsObject is a behavior to be used with WADE, and is part of the wade.physics plug-in.
It gives you access to many physical properties for WADE objects.
Example usage: var mySceneObject = new SceneObject(mySprite, PhysicsObject);
mySceneObject.getBehavior().linearDamping = 0.3;
Field Detail
active
Whether the physics object is active. Inactive objects are not simulated and cannot be collided with.

allowSleeping
Whether this object should be allowed to sleep. Objects are set to sleep when resting on other objects, to speed up the simulation.

angularDamping
The amount of damping (reduction in velocity) that is caused by angular motion. Usually between 0 and 1 (0 by default).

bodyType
The type of physics body. This is 'static' by default, indicating an immovable object. It can also be 'dynamic' or 'kinetic'

bullet
Whether the object is a bullet (a fast-moving object), which implies that it needs continuous collision detection to avoid going throug object

fixedRotation
Whether this object should only translate and never rotate.

gravityScale
A number to multiply the effect of gravity on this body. Setting this to 0 means that the object is not affected by gravity.

linearDamping
The amount of damping (reduction in velocity) that is caused by linear motion. Usually between 0 and 1 (0 by default).
Method Detail
{object} addFixture(fData)
Add a fixture to the physics body. A fixture is a convex shape with physics properties, and each physics body can have any number of fixtures.
Parameters:
fData
Returns:
{object} The fixture object. This can later be used to remove a fixture through removeFixture().

addMouseJoint(offset)
Add a mouse joint. A mouse joint is a target point that the object will try to follow when possible.
Parameters:
{{x: number|y: number}} offset
The point in object-space that will try to track the target point.
Returns:
A mouse joint object

applyForce(force, power, offset)
applyForce Apply a force to a box2d body As this uses a normalized vector, do not convert the force using wadeToBox. However, since the y axis are reversed in wade vs box2d, multiply the force.y by -1
Parameters:
force
power
offset

applyImpulse(impulse, power, offset)
applyImpulse Apply an impulse to a box2d body As this uses a normalized vector, do not convert the impulse using wadeToBox. However, since the y axis are reversed in wade vs box2d, multiply the impulse.y by -1
Parameters:
impulse
power
offset

applyTorque(torque)
applyTorque Apply a torque to the body in newton-meters Affects the angular velocity but not the linear velocity
Parameters:
torque

{function} draw_(color, originalDraw)
Get a debug draw function that shows the physics object using vector graphics. It currently only works for circle shapes.
Parameters:
{string} color Optional
The color to use to draw the silhouette of the physics object. Default is 'green'.
{function} originalDraw Optional
A draw function to call after drawing the silhouette of the physics object.
Returns:
{function} A draw function to use with Sprite.setDrawFunction()

{Array} getFixtureList()
Get a list of fixtures attached to this object
Returns:
{Array} An array of fixtures attached to this physics body

{Array} getJointList()
Get a list of joints attached to this object
Returns:
{Array} an array of joint objects attached to this body

{boolean} isAwake()
Check whether the physics object is awake or not. Objects can be not awake when they're resting on top of other objects, to improve the performance of the simulation
Returns:
{boolean} Whether the physics object is awake

removeFixture(fixture)
removeFixture Remove a fixture
Parameters:
fixture

removeMouseJoint(joint)
Remove a mouse joint from this object
Parameters:
{object} joint Optional
The joint object to remove. If omitted, the first mouse joint will be removed.

setAwake(value)
Set a physics object as awake or not. Objects can be not awake when they're resting on top of other objects, to improve the performance of the simulation
Parameters:
value

updateMouseJoint(joint, pos)
Update the position of the target point for a mouse joint
Parameters:
{object} joint Optional
The joint object to update, as previously returned by a call to addMouseJoint(). It can be omitted, in which case the first mouse joint will be used.
{{x: number|y: number}} pos
The new position of the target point

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jul 12 2016 07:54:40 GMT+0100 (BST)