class nape.constraint.Constraint

Available on all platforms

Base type for all Nape joints and constraints

Instance Fields

var 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. * * @default true

var breakUnderError:Bool

Whether constraint will break once maxError is reached. *

* This property effects both stiff and non-stiff constraints. * * @default false

var 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. * * @default false

var cbTypes:CbTypeList

Set of CbTypes for this constraints for callbacks. *

* This value cannot at present be set, but can be modified. * * @default [CbType.ANY_CONSTRAINT]

var 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. * * @default null

var 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. * * @default 1

var debugDraw:Bool

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. * @default true

var 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). * * @default 10

var 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. * * @default false

var isSleeping: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.

var 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. * * @default infinity

var 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. * * @default infinity

var 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. * * @default true

var 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. * * @default null

var 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. * * @default true

var userData:DynamicDynamic

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. * * @default {}

function new():Void

@private

function bodyImpulse(body:Body):Vec3

Compute impulse that was applied to the given Body. *

* This impulse is the actual (mass weighted) change in velocity * that occured due to this constraint. * *

body

The Body to compute impulse for. *

returns

The impulse that was applied to the body in the previous step. *

function copy():Constraint

Produce copy of constraint. *

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

returns

The copied Constraint.

function impulse():MatMN

Return the constraint-space impulse applied in previous step. * *

returns

A new MatMN representing the constraint space impulse.

function toString():String

@private

function visitBodies(lambda:Body ->Void):Void

Apply given function to all Bodys linked to the constraint. *

* If a body is duplicated in a constraint then it will only * be visited once. * *

lambda

The function to apply to each Body. *