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. 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.
Create a joint to constrain bodies together. This may cause the connected bodies to cease colliding. Warning: This function is locked during callbacks.
PARAMETERS
def
(Box2dJointDef) - Mouse joint definition.
RETURN
Mouse joint definition. This requires a world target point, tuning parameters, and the time step.
local Box2dMouseJointDef = {
--region JointNeeded
--endregion
--region JointOptional
The linear stiffness in N/m
stiffness = 0,
The linear damping in N*s/m
damping = 0,
The initial world target point. This is assumed
to coincide with the body anchor initially.
target = vmath.vector3(0),
The maximum constraint force that can be exerted
to move the candidate body. Usually you will express
as some multiple of the weight (multiplier * mass * gravity).
maxForce = 0
--endregion
}
- Box2dMouseJoint:SetTarget (target)
- Box2dMouseJoint:GetTarget ()
- Box2dMouseJoint:SetMaxForce (force)
- Box2dMouseJoint:GetMaxForce ()
- Box2dMouseJoint:SetStiffness (stiffness)
- Box2dMouseJoint:GetStiffness ()
- Box2dMouseJoint:SetDamping (damping)
- Box2dMouseJoint:GetDamping ()
Use this to update the target point.
PARAMETERS
target
(vector3) -
RETURN
- (vector3)
Set/get the maximum force in Newtons.
PARAMETERS
force
(number) -
RETURN
- (number)
Set/get the linear stiffness in N/m
PARAMETERS
stiffness
(number) -
RETURN
- (number)
Set/get linear damping in N*s/m
PARAMETERS
damping
(number) -
RETURN
- (number)