API Docs for: 0.7.1
Show:

FrictionEquation Class

Constrains the slipping in a contact along a tangent

Constructor

FrictionEquation

(
  • bodyA
  • bodyB
  • slipForce
)

Parameters:

  • bodyA Body
  • bodyB Body
  • slipForce Number

Methods

addToWlambda

(
  • deltalambda
)

Add constraint velocity to the bodies.

Parameters:

  • deltalambda Number

computeB

() Number

Computes the RHS of the SPOOK equation

Returns:

Number:

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:

Number:

computeGiMGt

() Number

Computes Ginv(M)G'

Returns:

Number:

computeGq

() Number

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

Returns:

Number:

computeGW

() Number

Computes G*W, where W are the body velocities

Returns:

Number:

computeGWlambda

() Number

Computes G*Wlambda, where W are the body velocities

Returns:

Number:

computeInvC

(
  • eps
)
Number

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

Parameters:

  • eps Number

Returns:

Number:

getSlipForce

() Number

Get the max force for the constraint.

Returns:

Number:

gmult

() Number

Multiply a jacobian entry with corresponding positions or velocities

Returns:

Number:

setSlipForce

(
  • slipForce
)

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

Parameters:

  • slipForce Number

update

()

Compute SPOOK parameters .a, .b and .epsilon according to the current parameters. See equations 9, 10 and 11 in the SPOOK notes.

Properties

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

Array

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

contactPointB

Array

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.

frictionCoefficient

Number

The friction coefficient to use.

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.

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

Shape

The shape in body i that triggered this friction.

shapeB

Shape

The shape in body j that triggered this friction.

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

Array

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