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.

Constructor

@:value({ phase : 0.0 })new(body1:Null<Body>, body2:Null<Body>, anchor1:Vec2, anchor2:Vec2, phase:Float = 0.0)

Construct a new WeldJoint.

Parameters:

body1

The first body in WeldJoint.

body2

The second body in WeldJoint.

anchor1

The first local anchor for joint.

anchor2

The second local anchor for joint.

phase

The angular phase of joint. (default 0)

Returns:

The constructed WeldJoint.

Variables

anchor1:Vec2

Anchor point on first Body.

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

anchor2:Vec2

Anchor point on second Body.

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

body1:Null<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.

body2:Null<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.

phase:Float

Angular phase of bodies in WeldJoint.

@:value(null)zpp_inner_zn:ZPP_WeldJoint = null

@private

Methods

bodyImpulse(body:Body):Vec3

@inheritDoc

impulse():MatMN

@inheritDoc

For this constraint, the MatMN will be 3x1.

visitBodies(lambda:Body ‑> Void):Void

@inheritDoc

Inherited Variables

Defined by Constraint

active:Bool

Whether this constraint is active or not.

Setting a constraint to be no longer active is a useful way of temporarigly disabling a constraint without having to remove it from a Space.

breakUnderError:Bool

Whether constraint will break once maxError is reached.

This property effects both stiff and non-stiff constraints.

breakUnderForce:Bool

Whether constraint will break once maxForce is reached.

This property effects both stiff and non-stiff constraints, though for the same reasons as those of maxForce, does not make much sense to be used in stiff constraints.

read onlycbTypes:CbTypeList

Set of CbTypes for this constraints for callbacks.

This value cannot at present be set, but can be modified.

compound:Null<Compound>

Compound this Constraints belong to.

If this constraint is in a Space or another Compound and you change its compound, then it will be removed from that Space or Compound.

damping:Float

Damping ratio of elastic properties of constraint.

This property only has an effect when constraint is not stiff.

This value corresponds to in the ideal situation, the damping ratio of the constraints oscillations with 1 corresponding to a total dampening, and values greater than one being over-dampening.

This value must be zero or positive.

@:value(true)debugDraw:Bool = true

Set to disable debug drawing/

When true, this Constraint will not be drawn during debug draw operations unless specifically given as argument to Debug draw() method.

frequency:Float

Frequency of elastic properties of constraint.

This property only has an effect when constraint is not stiff.

This value corresponds to in an ideal situation, the number of spring like oscillations the constraint will make per second.

This value must be strictly positive (0 not allowed).

ignore:Bool

Whether interactions between related Bodys will be ignored.

If true, then the Bodys related to this constraint will not be permitted to interact in anyway, including callbacks.

read onlyisSleeping:Bool

Whether this constraint is sleeping or not.

This property is only defined if the constraint is inside of a Space and is active, otherwise an error will be thrown should you access this property.

This value is immutable, In Nape you do not ever need to manually wake up a Constraint. It will always be done automatically without error.

To manually put a Constraint to sleep is against the very nature of Nape API and so is excluded from the core of Nape. If you really want to do this you should make use of the nape-hacks module.

maxError:Float

The maximum amount of error this constraint is allowed to use.

For stiff constraints, this value only serves to work in conjunction with breakUnderError to permit breaking of the constraint.

For non-stiff constraints, this value will also effect how the constraint behaves when breakUnderError is false by restricting the amount of error that will be resolved; this will not work for stiff constraints.

maxForce:Float

The maximum amount of force this constraint is allowed to use.

This value, whilst still used in a stiff constraint will not work as you might hope for; since a stiff constraint resolves positional error without using impulses, the maxForce will not have any effect on how positional errors are resolved.

This value must be zero or positive.

removeOnBreak:Bool

Whether constraint will be removed when it breaks.

If true, then when constraint is broken it will be removed from the Space. Otherwise it will simple be made inactive.

space:Null<Space>

Space this constraint is inside of.

Whether this constraint is directly in a Space, or part of a Compound which is inside of a space, this value will be equal to that Space.

If this constraint is inside of a Compound, then you cannot modify its Space as the constraint belongs to that Compound.

stiff:Bool

Whether constraint is stiff, or elastic.

A stiff constraint has its positional error resolved directly as with contact penetrations. This is generally a more stable way of solving positional errors but has a side-effect that for example changing the pivot point on a constraint used for mouse control will not cause the objects to swing as the positional error is solved without effecting the velocity of the object which may not be wanted.

If false, then the positional error of the constraint will be resolved in an elastic way using changes in velocity.

read onlyuserData:Dynamic<Dynamic>

Dynamic object for user to store additional data.

This object cannot be set, only its dynamically created properties may be set. In AS3 the type of this property is &#42

This object will be lazily constructed so that until accessed for the first time, will be null internally.

zpp_inner:ZPP_Constraint

@private

Inherited Methods

Defined by Constraint

copy():Constraint

Produce copy of constraint.

All constraint properties except for internal impulse cache and userData field will be copied.

Returns:

The copied Constraint.

@:keeptoString():String

@private