Class Index | File Index

Classes


Class R.components.physics.MouseJoint


Extends R.components.physics.BaseJoint.
A mouse joint which allows the mouse to be used to interact within a R.physics.Simulation. The typical usage is to query the world at the mouse position to determine what the mouse is currently over, then you begin simulation of the R.components.physics.MouseJoint component which links it to the body. When movement of the object via the mouse is no longer needed, stop simulation of the joint.
Defined in: mousejoint.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
R.components.physics.MouseJoint(name, body1, body2)
Creates a mouse joint between a rigid body and the mouse.
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 body component linked to this joint.
 
Get the class name of this object
 
Get the damping ratio from the joint definition.
 
Get the frequency from the joint definition.
 
Get the maximum force being applied when the mouse moves.
 
Release the object back into the pool.
 
setBody(body)
Set the body component which will be affected by the mouse.
 
setDampingRatio(dampingRatio)
Set the damping ratio which is used to determine joint softness.
 
Set the frequency which is used to determine joint softness.
 
setMaxForce(force)
Set the maximum force to apply to the body when the mouse moves.
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, 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.MouseJoint(name, body1, body2)
Creates a mouse joint between a rigid body and the mouse. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces.
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
Method Detail
{R.components.physics.BaseBody} getBody()
Get the body component linked to this joint.
Returns:
{R.components.physics.BaseBody}

{String} getClassName()
Get the class name of this object
Returns:
{String} "R.components.physics.MouseJoint"

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

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

{Number} getMaxForce()
Get the maximum force being applied when the mouse moves.
Returns:
{Number}

release()
Release the object back into the pool.

setBody(body)
Set the body component which will be affected by the mouse. This should be called when the joint is not being simulated.
Parameters:
body
{R.components.physics.BaseBody} The body component

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.

setMaxForce(force)
Set the maximum force to apply to the body when the mouse moves.
Parameters:
force
{Number} The force to apply

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