A trait to add Bullet physics constraints

Constructor

@:value({ limits : null })new(body1:Object, body2:Object, type:ConstraintType, disableCollisions:Bool, breakingThreshold:Float, ?limits:Array<Float>)

Function to initialize physics constraint trait.

Parameters:

object

Pivot object to which this constraint trait will be added. The constraint limits are applied along the local axes of this object. This object need not be a Rigid Body. Typically an Empty object may be used. Moving/rotating/parenting this pivot object has no effect once the constraint trait is added. Removing the pivot object removes the constraint.

body1

First rigid body to be constrained. This rigid body may be constrained by other constraints.

body2

Second rigid body to be constrained. This rigid body may be constrained by other constraints.

type

Type of the constraint.

disableCollisions

Disable collisions between constrained objects.

breakingThreshold

Break the constraint if stress on this constraint exceeds this value. Set to 0 to make un-breakable.

limits

Constraint limits. This may be set before adding the trait to pivot object using the set limits functions.

Variables

@:value(null)con:TypedConstraint = null

@:value(0)id:Int = 0

Methods

@:value({ isAngular : false, axis : X, upperLimit : -1.0, lowerLimit : 1.0, setLimit : false })setGenericConstraintLimits(setLimit:Bool = false, lowerLimit:Float = 1.0, upperLimit:Float = -1.0, axis:ConstraintAxis = X, isAngular:Bool = false):Void

Function to set customized constraint limits when using Generic/ Generic Spring constraint. May be used after initalizing this trait but before adding it to the pivot object. Multiple constarints may be set by calling this function with different parameters.

setHingeConstraintLimits(angLimit:Bool, lowerAngLimit:Float, upperAngLimit:Float):Void

Function to set constraint limits when using Hinge constraint. May be used after initalizing this trait but before adding it to the pivot object

setPistonConstraintLimits(linLimit:Bool, lowerLinLimit:Float, upperLinLimit:Float, angLimit:Bool, lowerAngLimit:Float, upperAngLimit:Float):Void

Function to set constraint limits when using Piston constraint. May be used after initalizing this trait but before adding it to the pivot object

setSliderConstraintLimits(linLimit:Bool, lowerLinLimit:Float, upperLinLimit:Float):Void

Function to set constraint limits when using Slider constraint. May be used after initalizing this trait but before adding it to the pivot object

@:value({ isAngular : false, axis : X, damping : 0.5, stiffness : 10.0, setSpring : false })setSpringParams(setSpring:Bool = false, stiffness:Float = 10.0, damping:Float = 0.5, axis:ConstraintAxis = X, isAngular:Bool = false):Void

Function to set customized spring parameters when using Generic/ Generic Spring constraint. May be used after initalizing this trait but before adding it to the pivot object. Multiple parameters to different axes may be set by calling this function with different parameters.

Inherited Variables

Defined by Trait

@:value("")name:String = ""

object:Object

Object this trait belongs to.

Inherited Methods

Defined by Trait

notifyOnAdd(f:() ‑> Void):Void

Trait is added to an object.

notifyOnInit(f:() ‑> Void):Void

Object which this trait belongs to is added to scene.

notifyOnLateUpdate(f:() ‑> Void):Void

Add late game logic handler.

notifyOnRemove(f:() ‑> Void):Void

Object which this trait belongs to is removed from scene.

notifyOnRender(f:Graphics ‑> Void):Void

Add render handler.

notifyOnRender2D(f:Graphics ‑> Void):Void

Add 2D render handler.

notifyOnUpdate(f:() ‑> Void):Void

Add game logic handler.

remove():Void

Remove the trait from the object.

removeLateUpdate(f:() ‑> Void):Void

Remove late game logic handler.

removeRender(f:Graphics ‑> Void):Void

Remove render handler.

removeRender2D(f:Graphics ‑> Void):Void

Remove 2D render handler.

removeUpdate(f:() ‑> Void):Void

Remove game logic handler.