ContactEquation Class
Non-penetration constraint equation. Tries to make the ri and rj vectors the same point.
Item Index
Methods
Properties
Methods
addToWlambda
-
deltalambda
Add constraint velocity to the bodies.
Parameters:
-
deltalambda
Number
computeB
()
Number
Computes the RHS of the SPOOK equation
Returns:
computeC
-
eps
Compute the denominator part of the SPOOK equation: C = Ginv(M)G' + eps
Parameters:
-
eps
Number
Returns:
computeGiMf
()
Number
Computes Ginv(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 Ginv(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:
updateSpookParams
-
timeStep
Update SPOOK parameters .a, .b and .eps according to the given time step. See equations 9, 10 and 11 in the SPOOK notes.
Parameters:
-
timeStep
Number
Properties
firstImpact
Boolean
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.
ni
Array
The normal vector, pointing out of body i
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.
ri
Array
Vector from body i center of mass to the contact point.
rj
Array
Vector from body j center of mass to the contact point.
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.