Class R.components.physics.BaseMotorJoint
Extends
R.components.physics.BaseJoint.
The base motor joint for all joints which can be driven by a motor.
Defined in: basemotorjoint.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.components.physics.BaseMotorJoint(name, body1, body2, anchor)
Creates a revolute joint between two physical bodies.
|
- Fields borrowed from class R.components.Base:
- TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Attributes | Method Name and Description |
---|---|
Clear the motor force.
|
|
Get the class name of this object
|
|
Get the force which will be applied when the joint is used as a motor.
|
|
Get the speed of the motor.
|
|
During simulation, get the reaction force vector of the joint.
|
|
During simulation, get the reaction torque.
|
|
setMotorForce(force)
Set the force which is applied via the motor, or to resist forces applied to it.
|
|
setMotorSpeed(speed)
Set the speed of the motor applied to the joint.
|
- Methods borrowed from class R.components.physics.BaseJoint:
- getBody1, getBody2, getCollideBodies, getJoint, getJointDef, getSimulation, offset, 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.BaseMotorJoint(name, body1, body2, anchor)
Creates a revolute joint between two physical bodies.
- 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
- anchor
- {R.math.Point2D} A point, in world coordinates relative to the two bodies, to use as the joint's anchor point
Method Detail
clearForce()
Clear the motor force.
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.components.physics.BaseMotorJoint"
{Number}
getMotorForce()
Get the force which will be applied when the joint is used as a motor.
- Returns:
- {Number}
{Number}
getMotorSpeed()
Get the speed of the motor. During simulation, the value returned is the
joint's speed, not the speed set for the motor.
- Returns:
- {Number}
{R.math.Vector2D}
getReactionForce()
During simulation, get the reaction force vector of the joint. Outside
of simulation, the vector will be zero.
- Returns:
- {R.math.Vector2D}
{Number}
getReactionTorque()
During simulation, get the reaction torque. Outside of simulation, the
torque is zero.
- Returns:
- {Number}
setMotorForce(force)
Set the force which is applied via the motor, or to resist forces applied to it. You can
use this value to simulate joint friction by setting the motor speed to zero
and applying a small amount of force. During simulation, the force is applied directly
to the joint. In joints where torque is used, the force is applied to the torque instead.
- Parameters:
- force
- {Number} The amount of force to apply
setMotorSpeed(speed)
Set the speed of the motor applied to the joint.
- Parameters:
- speed
- {Number} The speed of the motor