A trait to add Bullet physics constraints
Constructor
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 |
---|---|
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
Methods
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
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.