Packagecom.fileitup.fisixengine.primitives
Classpublic class Constraint
ImplementsEngineObject
SubclassesAngularConstraint, SpringConstraint

The base class upon which all constraints are created. This class is never used as a constraint, but is instead extended.

All constraints have the following capabilities:
- breaking point through the breakPoint property
- min/max values to constrain withing a range rather than a single value

For specific features, see the individual constraint objects

See also

com.fileitup.fisixengine.constraints


Public Properties
 PropertyDefined by
  breakPoint : Number
The point at which a constraint should be broken.
Constraint
  broken : Boolean
[read-only]Tells you whether or not a constraint is currently broken.
Constraint
  max : Number
The upper range of the constraint.
Constraint
  min : Number
The lower range of the constraint.
Constraint
  parent : FisixObject
Constraint
  restLength : Number
The length that the constraint will attempt to maintain.
Constraint
  stiffness : Number
A value between 0 - 1 representing the stiffness of the constraint.
Constraint
  unloadOnBreak : Boolean = true
When true, the constraint is removed from the simulation when broken.
Constraint
Public Methods
 MethodDefined by
  
Constraint
  
dispose():void
Constraint
  
render(g:Graphics):void
Constraint
  
setMinMax(minimum:Number, maximum:Number):void
Sets both min and max values in one line
Constraint
  
solve():void
Constraint
  
unload():void
Constraint
Protected Methods
 MethodDefined by
  
Constraint
  
onBreak():void
Constraint
  
onUnload():void
Constraint
  
solveConstraint(len:Number, len2:Number):void
Constraint
Property detail
breakPointproperty
breakPoint:Number  [read-write]

The point at which a constraint should be broken.

This is set to 0 by default at which value the constraint is unbreakable.

For spring and stick constraints, this value represents the percentage of the constraint's stretch.
1 represents no stretch (breaking the constraint immidiately)
1.5 represents a 50% stretch, and so on.
valid values are any number greater than 0

For angular constraints, this value represents the amount of degrees that a constraint must go over it's range in order to break.
valid values are degree-values between 0 and 360. No negatives.

Implementation
    public function get breakPoint():Number
    public function set breakPoint(value:Number):void
brokenproperty 
broken:Boolean  [read-only]

Tells you whether or not a constraint is currently broken. This is only usable if unloadOnBrak is set to true.

Implementation
    public function get broken():Boolean

See also

maxproperty 
max:Number  [read-write]

The upper range of the constraint.

By setting this value, you are disabling the use of the restLength property, so it's good practice to set both the min and max values at the same time.
Note that valid values are always positive values.
In order to disable the maximum bound, set this property to a negative value.

Implementation
    public function get max():Number
    public function set max(value:Number):void

See also

minproperty 
min:Number  [read-write]

The lower range of the constraint.

By setting this value, you are disabling the use of the restLength property, so it's good practice to set both the min and max values at the same time.
Note that valid values are always positive values.
In order to disable the minimum bound, set this property to a negative value.

Implementation
    public function get min():Number
    public function set min(value:Number):void

See also

parentproperty 
public var parent:FisixObject
restLengthproperty 
restLength:Number  [read-write]

The length that the constraint will attempt to maintain.

For spring and stick constraints, this represents a pixel distance
For angular constraints, this represents a degree value between 0 and 360.
For more information about angle measures in angular constraints, see the documentation for the AngularConstraint class

Note that by setting this value you disable the use of min/max values (in other words, the constraint is no longer bound to a range, but only one value)

Implementation
    public function get restLength():Number
    public function set restLength(value:Number):void

See also

stiffnessproperty 
stiffness:Number  [read-write]

A value between 0 - 1 representing the stiffness of the constraint.
1 represents a completely stiff constraint. The closer the value is to 0, the more 'springy' the constraint is.

Note that another factor which affects the stiffness of constraints is the amount of times the constraints are solved per frame (Through the 'iterations' property)

Implementation
    public function get stiffness():Number
    public function set stiffness(value:Number):void

See also

unloadOnBreakproperty 
public var unloadOnBreak:Boolean = true

When true, the constraint is removed from the simulation when broken. By default this value is true, but when set to false it creates very interesting results.

when set to false, the constraint becomes inactive when broken, but as soon as it comes within valid range, it becomes active again. Give it a try


If you'd like to know whether or not the constraint is currently broken, refer to the constraint's 'broken' property.

See also

Constructor detail
Constraint()constructor
public function Constraint()
Method detail
breakConstraint()method
protected function breakConstraint():void
dispose()method 
public function dispose():void
onBreak()method 
protected function onBreak():void
onUnload()method 
protected function onUnload():void
render()method 
public function render(g:Graphics):voidParameters
g:Graphics
setMinMax()method 
public function setMinMax(minimum:Number, maximum:Number):void

Sets both min and max values in one line

Parameters
minimum:Number
 
maximum:Number
solve()method 
public function solve():void
solveConstraint()method 
protected function solveConstraint(len:Number, len2:Number):voidParameters
len:Number
 
len2:Number
unload()method 
public function unload():void