Class R.components.physics.BaseJoint
Extends
R.components.Logic.
The base component which initializes physical joints for use in a R.physics.Simulation.
Defined in: basejoint.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.components.physics.BaseJoint(name, body1, body2, jointDef)
All physics joint components extend from this component type.
|
- Fields borrowed from class R.components.Base:
- TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Attributes | Method Name and Description |
---|---|
getBody1()
Get the component which corresponds to body 1 of the joint.
|
|
getBody2()
Get the component which corresponds to body 2 of the joint.
|
|
Get the class name of this object
|
|
Returns
true if the two bodies will check for collisions
with eachother during the simulation. |
|
getJoint()
Get the Box2d joint object.
|
|
Get the Box2d joint definition object.
|
|
Get the simulation this joint is active within.
|
|
offset(pt)
Offset the joint's anchors by the given point
|
|
setBody1(body)
Set the first body of the joint.
|
|
setBody2(body)
Set the second body of the joint.
|
|
setCollideBodies(state)
Set a flag which determines if the two bodies will collide with eachother
during simulation.
|
|
Start simulating the joint.
|
|
Stop simulating the body.
|
- 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.BaseJoint(name, body1, body2, jointDef)
All physics joint components extend from this component type.
- Parameters:
- name
- {String} Name of the component
- body1
- {b2Body} The first body of the joint
- body2
- {b2Body} The second body of the joint
- jointDef
- {b2JointDef} The joint definition.
Method Detail
{R.components.BaseBody}
getBody1()
Get the component which corresponds to body 1 of the joint.
- Returns:
- {R.components.BaseBody}
{R.components.BaseBody}
getBody2()
Get the component which corresponds to body 2 of the joint.
- Returns:
- {R.components.BaseBody}
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.components.physics.BaseJoint"
{Boolean}
getCollideBodies()
Returns
true
if the two bodies will check for collisions
with eachother during the simulation. The default is false
.
- Returns:
- {Boolean}
{b2Joint}
getJoint()
Get the Box2d joint object.
- Returns:
- {b2Joint}
{b2JointDef}
getJointDef()
Get the Box2d joint definition object.
- Returns:
- {b2JointDef}
{R.physics.Simuation}
getSimulation()
Get the simulation this joint is active within.
- Returns:
- {R.physics.Simuation}
offset(pt)
Offset the joint's anchors by the given point
- Parameters:
- pt
- {R.math.Point2D} The offset amount
setBody1(body)
Set the first body of the joint. This should only be called when the
joint is not being simulated.
- Parameters:
- body
- {R.components.physics.BaseBody} The body component
setBody2(body)
Set the second body of the joint. This should only be called when the
joint is not being simulated.
- Parameters:
- body
- {R.components.physics.BaseBody} The body component
setCollideBodies(state)
Set a flag which determines if the two bodies will collide with eachother
during simulation. After the simulation has started, you cannot change this
flag without first stopping simulation on the bodies and joint.
- Parameters:
- state
- {Boolean} Set to
true
to enable collisions between the two bodies. Default:false
startSimulation()
Start simulating the joint. If the joint isn't a part of the simulation,
it is added and simulation occurs.
stopSimulation()
Stop simulating the body. If the body is a part of a simulation,
it is removed and simulation stops. The position and rotation of
the body will not be updated.