Class Index | File Index

Classes


Class R.components.physics.DistanceJoint


Extends R.components.physics.BaseJoint.
A distance joint which maintains constant distance between two bodies in a R.physics.Simulation. You can picture this as a massless rigid rod anchored at the two anchor points.
Defined in: distancejoint.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
R.components.physics.DistanceJoint(name, body1, body2, anchor1, anchor2)
Creates a distance joint between two physical bodies.
Fields borrowed from class R.components.Base:
TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Summary
Method Attributes Method Name and Description
 
Get the class name of this object
 
Get the damping ratio from the joint definition.
 
Get the frequency from the joint definition.
 
offset(pt)
Offset the joint's anchors by the given point
 
setDampingRatio(dampingRatio)
Set the damping ratio which is used to determine joint softness.
 
Set the frequency which is used to determine joint softness.
Methods borrowed from class R.components.physics.BaseJoint:
getBody1, getBody2, getCollideBodies, getJoint, getJointDef, getSimulation, setBody1, setBody2, setCollideBodies, startSimulation, stopSimulation
Methods borrowed from class R.components.Base:
execute, getGameObject, getHostObject, getPriority, getType, getTypeString, release, setGameObject, setHostObject, setPriority
Methods borrowed from class R.engine.BaseObject:
addEvent, addEvents, destroy, getElement, jQ, removeEvent, setElement, triggerEvent, update
Methods borrowed from class R.engine.PooledObject:
clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.components.physics.DistanceJoint(name, body1, body2, anchor1, anchor2)
Creates a distance joint between two physical bodies. The distance can be softened by adjusting the frequency and the damping ratio of the joint. Rotation is not limited by this joint. If you do not specify anchor 1 or anchor 2, the joint will use the position of each body offset by its physical origin.
Parameters:
name
{String} Name of the component
body1
{R.components.physics.BaseBody} The first body for the joint
body2
{R.components.physics.BaseBody} The second body for the joint
anchor1
{R.math.Vector2D} The anchor on body 1, or null
anchor2
{R.math.Vector2D} The anchor on body 2, or null
Method Detail
{String} getClassName()
Get the class name of this object
Returns:
{String} "R.components.physics.DistanceJoint"

{Number} getDampingRatio()
Get the damping ratio from the joint definition.
Returns:
{Number}

{Number} getFrequency()
Get the frequency from the joint definition.
Returns:
{Number}

offset(pt)
Offset the joint's anchors by the given point
Parameters:
pt
{R.math.Point2D} The offset amount

setDampingRatio(dampingRatio)
Set the damping ratio which is used to determine joint softness. The value should be between 0.0 and 1.0, with 1.0 being extremely rigid.
Parameters:
dampingRatio
{Number} A value between 0.0 and 1.0

setFrequency(hz)
Set the frequency which is used to determine joint softness. According to Box2d documentation the frequency should be less than half of the time step used for the simulation. In the engine, the frequency of the time step is the frame rate.
Parameters:
hz
{Number} The frequency in Hertz.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 18 2013 16:09:17 GMT-0400 (EDT)