Package | com.fileitup.fisixengine.primitives |
Class | public class Constraint |
Implements | EngineObject |
Subclasses | AngularConstraint, SpringConstraint |
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
See also
Property | Defined 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 |
Method | Defined 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 |
Method | Defined by | ||
---|---|---|---|
breakConstraint():void
| Constraint | ||
onBreak():void
| Constraint | ||
onUnload():void
| Constraint | ||
solveConstraint(len:Number, len2:Number):void
| Constraint |
breakPoint | property |
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.
public function get breakPoint():Number
public function set breakPoint(value:Number):void
broken | property |
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
max | property |
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.
public function get max():Number
public function set max(value:Number):void
See also
min | property |
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.
public function get min():Number
public function set min(value:Number):void
See also
parent | property |
public var parent:FisixObject
restLength | property |
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
stiffness | property |
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)
public function get stiffness():Number
public function set stiffness(value:Number):void
See also
unloadOnBreak | property |
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
See also
Constraint | () | constructor |
public function Constraint()
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):void
Parameters
g:Graphics |
setMinMax | () | method |
public function setMinMax(minimum:Number, maximum:Number):void
Sets both min and max values in one line
Parametersminimum:Number |
|
maximum:Number |
solve | () | method |
public function solve():void
solveConstraint | () | method |
protected function solveConstraint(len:Number, len2:Number):void
Parameters
len:Number |
|
len2:Number |
unload | () | method |
public function unload():void