Appearance
Class: MouseJoint
A mouse joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces.
You need to call setTarget(target) every time that mouse is moved, to track the new location of the mouse.
NOTE: this joint is not documented in the manual because it was developed to be used in the testbed. If you want to learn how to use the mouse joint, look at the testbed.
Extends
Constructors
Constructor
new MouseJoint(
def):MouseJoint
Parameters
def
Returns
MouseJoint
Overrides
Constructor
new MouseJoint(
def,bodyA,bodyB,target?):MouseJoint
Parameters
def
bodyA
bodyB
target?
Returns
MouseJoint
Overrides
Properties
style
style:
Style={}
Styling for dev-tools.
Inherited from
TYPE
staticTYPE:"mouse-joint"
Methods
getAnchorA()
getAnchorA():
Vec2
Get the anchor point on bodyA in world coordinates.
Returns
Overrides
getAnchorB()
getAnchorB():
Vec2
Get the anchor point on bodyB in world coordinates.
Returns
Overrides
getBodyA()
getBodyA():
Body
Get the first body attached to this joint.
Returns
Inherited from
getBodyB()
getBodyB():
Body
Get the second body attached to this joint.
Returns
Inherited from
getCollideConnected()
getCollideConnected():
boolean
Get collide connected. Note: modifying the collide connect flag won't work correctly because the flag is only checked when fixture AABBs begin to overlap.
Returns
boolean
Inherited from
getDampingRatio()
getDampingRatio():
number
Get the damping ratio (dimensionless).
Returns
number
getFrequency()
getFrequency():
number
Get the frequency in Hertz.
Returns
number
getMaxForce()
getMaxForce():
number
Get the maximum force in Newtons.
Returns
number
getNext()
getNext():
Joint
Get the next joint the world joint list.
Returns
Inherited from
getReactionForce()
getReactionForce(
inv_dt):Vec2
Get the reaction force on bodyB at the joint anchor in Newtons.
Parameters
inv_dt
number
Returns
Overrides
getReactionTorque()
getReactionTorque(
inv_dt):number
Get the reaction torque on bodyB in N*m.
Parameters
inv_dt
number
Returns
number
Overrides
getTarget()
getTarget():
Vec2
Returns
getType()
getType():
string
Get the type of the concrete joint.
Returns
string
Inherited from
getUserData()
getUserData():
unknown
Returns
unknown
Inherited from
initVelocityConstraints()
initVelocityConstraints(
step):void
Parameters
step
Returns
void
Overrides
isActive()
isActive():
boolean
Short-cut function to determine if either body is inactive.
Returns
boolean
Inherited from
setDampingRatio()
setDampingRatio(
ratio):void
Set the damping ratio (dimensionless).
Parameters
ratio
number
Returns
void
setFrequency()
setFrequency(
hz):void
Set the frequency in Hertz.
Parameters
hz
number
Returns
void
setMaxForce()
setMaxForce(
force):void
Set the maximum force in Newtons.
Parameters
force
number
Returns
void
setTarget()
setTarget(
target):void
Use this to update the target point.
Parameters
target
Returns
void
setUserData()
setUserData(
data):void
Parameters
data
unknown
Returns
void
Inherited from
shiftOrigin()
shiftOrigin(
newOrigin):void
Shift the origin for any points stored in world coordinates.
Parameters
newOrigin
Returns
void
Overrides
solvePositionConstraints()
solvePositionConstraints(
step):boolean
This returns true if the position errors are within tolerance.
Parameters
step
Returns
boolean
Overrides
Joint.solvePositionConstraints
solveVelocityConstraints()
solveVelocityConstraints(
step):void
Parameters
step
Returns
void