ContactEquation Class
Non-penetration constraint equation. Tries to make the contactPointA and contactPointB vectors coincide, while keeping the applied force repulsive.
Item Index
Methods
Methods
addToWlambda
-
deltalambda
Add constraint velocity to the bodies.
Parameters:
-
deltalambda
Number
computeB
()
Number
Computes the RHS of the SPOOK equation
Returns:
computeGiMf
()
Number
Computes G*inv(M)*f, where M is the mass matrix with diagonal blocks for each body, and f are the forces on the bodies.
Returns:
computeGiMGt
()
Number
Computes G*inv(M)*G'
Returns:
computeGq
()
Number
Computes G*q, where q are the generalized body coordinates
Returns:
computeGW
()
Number
Computes G*W, where W are the body velocities
Returns:
computeGWlambda
()
Number
Computes G*Wlambda, where W are the body velocities
Returns:
computeInvC
-
eps
Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps
Parameters:
-
eps
Number
Returns:
gmult
()
Number
Multiply a jacobian entry with corresponding positions or velocities
Returns:
update
()
Compute SPOOK parameters .a, .b and .epsilon according to the current parameters. See equations 9, 10 and 11 in the SPOOK notes.
Properties
contactPointA
Array
Vector from body i center of mass to the contact point.
contactPointB
Array
World-oriented vector from body A center of mass to the contact point.
enabled
Boolean
Whether this equation is enabled or not. If true, it will be added to the solver.
firstImpact
Boolean
This property is set to true if this is the first impact between the bodies (not persistant contact).
G
Array
The Jacobian entry of this equation. 6 numbers, 3 per body (x,y,angle).
maxForce
Number
Max force to apply when solving.
minForce
Number
Minimum force to apply when solving.
multiplier
Number
The resulting constraint multiplier from the last solve. This is mostly equivalent to the force produced by the constraint.
needsUpdate
Boolean
Indicates if stiffness or relaxation was changed.
normalA
Array
The normal vector, pointing out of body i
relativeVelocity
Number
Relative velocity.
relaxation
Number
The number of time steps needed to stabilize the constraint equation. Typically between 3 and 5 time steps.
restitution
Number
The restitution to use (0=no bounciness, 1=max bounciness).
stiffness
Number
The stiffness of this equation. Typically chosen to a large number (~1e7), but can be chosen somewhat freely to get a stable simulation.