nape.constraint.UserConstraint

type
class
extends
Constraint
subclasses
nape.symbolic.SymbolicConstraint
UserConstraint providing a low-level API for user-defined Constraints.

This API is intended to be powerful enough to model any constraint that Nape can handle, but not so low level as to be completely prohibitive.
For instance, things like soft-constraints are automatically provided by this API.

Working with this API will require mathematical skills. A full manual for this API is provided at: http://napephys.com/help/Constraints.pdf

You may also be interested in the nape-symbolic module that is available on github/haxelib/nape downloads. Which provides a run-time compiled DSL using this API to make prototyping (or creating non-performance critical) user-defined constraints simple without the need for great mathematical skills as well as being much quicker to work with.

Constructor

function new(dimensions:Int, velocityOnly:Bool = null)
+ Base constructor for user constraints.

Instance Properties hide inherited show inherited

var active : Bool = true

+ Whether this constraint is active or not.

var breakUnderError : Bool = false

+ Whether constraint will break once maxError is reached.

var breakUnderForce : Bool = false

+ Whether constraint will break once maxForce is reached.

readonly var cbTypes : nape.callbacks.CbTypeList = [CbType.ANY_CONSTRAINT]

+ Set of CbTypes for this constraints for callbacks.

var compound : Null<nape.phys.Compound> = null

+ Compound this Constraints belong to.

var damping : Float = 1

+ Damping ratio of elastic properties of constraint.

var debugDraw : Bool = true

+ Set to disable debug drawing/

var frequency : Float = 10

+ Frequency of elastic properties of constraint.

var ignore : Bool = false

+ Whether interactions between related Bodys will be ignored.

readonly var isSleeping : Bool

+ Whether this constraint is sleeping or not.

var maxError : Float = infinity

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

var maxForce : Float = infinity

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

var removeOnBreak : Bool = true

+ Whether constraint will be removed when it breaks.

var space : Null<nape.space.Space> = null

+ Space this constraint is inside of.

var stiff : Bool = true

+ Whether constraint is stiff, or elastic.

readonly var userData : Dynamic<Dynamic> = {}

+ Dynamic object for user to store additional data.

Instance Methods hide inherited show inherited

function __bindVec2():nape.geom.Vec2

+ Create a Vec2 property for user-constraint.

function __broken():Void

+ Internal extra steps in breaking constraint

function __clamp(jAcc:nape.TArray<Float>):Void

+ Internal, optional clamping of impulse for constraint.

function __copy():UserConstraint

+ Internal copying of user defined constraint.

function __draw(debug:nape.util.Debug):Void

+ Internal debug drawing of constraint.

function __eff_mass(eff:nape.TArray<Float>):Void

+ Internal effective mass matrix function for constraint.

function __impulse(imp:nape.TArray<Float>, body:nape.phys.Body, out:nape.geom.Vec3):Void

+ Internal application of impulse to body.

function __invalidate():Void

+ Internal method to invalidate constraint on property changes

function __position(err:nape.TArray<Float>):Void

+ Internal positional error function for constraint.

function __prepare():Void

+ Internal position dependant calculations for constraint.

function __registerBody(oldBody:Null<nape.phys.Body>, newBody:Null<nape.phys.Body>):Null<nape.phys.Body>

+ Internal method to register Body's with constraint.

function __validate():Void

+ Internal validation of constraint.

function __velocity(err:nape.TArray<Float>):Void

+ Internal velocity error function for constraint.

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

+ inheritDoc

copy():Constraint

+ Produce copy of constraint.

function impulse():nape.geom.MatMN

+ inheritDoc

function visitBodies(lambda:nape.phys.Body -> Void):Void

+ inheritDoc