API Docs for: 0.7.1
Show:

AngleLockEquation Class

Locks the relative angle between two bodies. The constraint tries to keep the dot product between two vectors, local in each body, to zero. The local angle in body i is a parameter.

Constructor

AngleLockEquation

(
  • bodyA
  • bodyB
  • [options]
)

Parameters:

  • bodyA Body
  • bodyB Body
  • [options] Object optional
    • [angle] Number optional

      Angle to add to the local vector in body A.

    • [ratio] Number optional

      Gear ratio

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 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:

computeGiMGt

() Number

Computes G*inv(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 = G*inv(M)*G' + eps

Parameters:

  • eps Number

Returns:

Number:

gmult

() Number

Multiply a jacobian entry with corresponding positions or velocities

Returns:

Number:

setMaxTorque

(
  • torque
)

Set the max force for the equation.

Parameters:

  • torque Number

setRatio

(
  • ratio
)

Set the gear ratio for this equation

Parameters:

  • ratio 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

enabled

Boolean

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

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.

ratio

Number private

The gear ratio.

relativeVelocity

Number

Relative velocity.

relaxation

Number

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

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.