Class FrictionEquation

Constrains the slipping in a contact along a tangent

Hierarchy

Constructors

Properties

B: number
G: Vec2

The Jacobian entry of this equation. 6 numbers, 3 per body (x,y,angle).

a: number
b: number
bodyA: Body

First body participating in the constraint

bodyB: Body

Second body participating in the constraint

contactEquations: ContactEquation[]

ContactEquations connected to this friction equation. The contact equations can be used to rescale the max force for the friction. If more than one contact equation is given, then the max force can be set to the average.

contactPointA: Vec2

Relative vector from center of body A to the contact point, world oriented.

contactPointB: Vec2

Relative vector from center of body B to the contact point, world oriented.

enabled: boolean

Whether this equation is enabled or not. If true, it will be added to the solver.

epsilon: number
frictionCoefficient: number

The friction coefficient to use.

index: number
invC: number
lambda: number
maxBias: number

Cap the constraint violation (G*q) to this value.

maxForce: number

Max force to apply when solving.

maxForceDt: number
minForce: number

Minimum force to apply when solving.

minForceDt: number
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.

offset: number
relativeVelocity: number

Relative velocity.

relaxation: number

The number of time steps needed to stabilize the constraint equation. Typically between 3 and 5 time steps.

shapeA: null | Shape

The shape in body i that triggered this friction.

Todo

Needed? The shape can be looked up via contactEquation.shapeA...

shapeB: null | Shape

The shape in body j that triggered this friction.

Todo

Needed? The shape can be looked up via contactEquation.shapeB...

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.

t: Vec2

Tangent vector that the friction force will act along. World oriented.

timeStep: number
DEFAULT_RELAXATION: number = 4

The default relaxation when creating a new Equation.

DEFAULT_STIFFNESS: number = 1e6

The default stiffness when creating a new Equation.

Methods

  • Add constraint velocity to the bodies.

    Parameters

    • deltalambda: number

    Returns void

  • Computes the RHS of the SPOOK equation

    Parameters

    • a: number
    • b: number
    • h: number

    Returns number

  • Computes G*W, where W are the body velocities

    Returns number

  • Computes G*Wlambda, where W are the body velocities

    Returns number

  • Computes G*inv(M)*G'

    Returns 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 number

  • Computes G*q, where q are the generalized body coordinates

    Returns number

  • Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps

    Parameters

    • eps: number

    Returns number

  • Get the max force for the constraint.

    Returns number

  • Multiply a jacobian entry with corresponding positions or velocities

    Parameters

    Returns number

  • Set the slipping condition for the constraint. The friction force cannot be larger than this value.

    Parameters

    • slipForce: number

    Returns void

  • Returns void