WeldJoint

Constraintnape.constraint.WeldJoint (final class)

WeldJoint constraining two bodies to be exactly locked together.

The equation for this constraint is:

[ body2.localPointToWorld(anchor2) ] = [ body1.localPointToWorld(anchor1) ]
[          body2.rotation          ]   [      body1.rotation + phase      ]

This constraint is equivalent to using a PivotJoint and AngleJoint together except that it is solved as a single constraint and thus will be more stable.

This constraint is 3 dimensional.

Although this constraint is very stable, if you chain bodies together using this constraint, you should except to see a small amount of rotation about the anchor points so you should chose them accordingly.

Instance Members

@private


nape
body1: Null<nape.phys.Body>

First Body in constraint.

This value may be null, but trying to simulate the constraint whilst this body is null will result in an error.


nape
body2: Null<nape.phys.Body>

Second Body in constraint.

This value may be null, but trying to simulate the constraint whilst this body is null will result in an error.


nape
anchor1: nape.geom.Vec2

Anchor point on first Body.

This anchor point is defined in the local coordinate system of body1.


nape
anchor2: nape.geom.Vec2

Anchor point on second Body.

This anchor point is defined in the local coordinate system of body2.


nape
phase: Float

Angular phase of bodies in WeldJoint.

@default 0


nape
impulse(): nape.geom.MatMN

@inheritDoc

For this constraint, the MatMN will be 3x1.

Returns
nape.geom.MatMN

nape
bodyImpulse(body: nape.phys.Body): nape.geom.Vec3

@inheritDoc

Name Type
body nape.phys.Body
Returns
nape.geom.Vec3

nape
visitBodies(lambda: Function): Void

@inheritDoc

Name Type
lambda Function

nape
new(body1: Null<nape.phys.Body>, body2: Null<nape.phys.Body>, anchor1: nape.geom.Vec2, anchor2: nape.geom.Vec2, ?phase: Float = 0.0): Void

Construct a new WeldJoint.

Name Type Default Description
body1 Null<nape.phys.Body> The first body in WeldJoint.
body2 Null<nape.phys.Body> The second body in WeldJoint.
anchor1 nape.geom.Vec2 The first local anchor for joint.
anchor2 nape.geom.Vec2 The second local anchor for joint.
phase Float 0.0 The angular phase of joint. (default 0)

Private Members

Metadata

Name Parameters
:final -