PrismaticConstraint Class
Constraint that only allows bodies to move along a line, relative to each other. See this tutorial. Also called "slider constraint".
Constructor
PrismaticConstraint
-
bodyA
-
bodyB
-
[options]
Parameters:
-
bodyA
Body -
bodyB
Body -
[options]
Object optional-
[maxForce]
Number optionalMax force to be applied by the constraint
-
[localAnchorA]
Array optionalBody A's anchor point, defined in its own local frame.
-
[localAnchorB]
Array optionalBody B's anchor point, defined in its own local frame.
-
[localAxisA]
Array optionalAn axis, defined in body A frame, that body B's anchor point may slide along.
-
[disableRotationalLock]
Boolean optionalIf set to true, bodyB will be free to rotate around its anchor point.
-
[upperLimit]
Number optional -
[lowerLimit]
Number optional
-
Item Index
Methods
disableMotor
()
Disable the rotational motor
enableMotor
()
Enable the motor
setLimits
-
lower
-
upper
Set the constraint limits.
Parameters:
-
lower
NumberLower limit.
-
upper
NumberUpper limit.
setRelaxation
-
relaxation
Set relaxation for this constraint.
Parameters:
-
relaxation
Number
setStiffness
-
stiffness
Set stiffness for this constraint.
Parameters:
-
stiffness
Number
update
()
Update the constraint equations. Should be done if any of the bodies changed position, before solving.
Properties
collideConnected
Boolean
Set to true if you want the connected bodies to collide.
Default: true
equations
Array
Equations to be solved in this constraint
localAnchorA
Array
localAnchorB
Array
localAxisA
Array
lowerLimit
Number
Lower constraint limit. The constraint position is forced to be larger than this value.
lowerLimitEnabled
Boolean
Set to true to enable lower limit.
motorEnabled
Boolean
The current motor state. Enable or disable the motor using .enableMotor
motorSpeed
Number
Set the target speed for the motor.
position
Number
The position of anchor A relative to anchor B, along the constraint axis.
type
Number
The type of constraint. May be one of Constraint.DISTANCE, Constraint.GEAR, Constraint.LOCK, Constraint.PRISMATIC or Constraint.REVOLUTE.
upperLimit
Number
Upper constraint limit. The constraint position is forced to be smaller than this value.
upperLimitEnabled
Boolean
Set to true to enable upper limit.