Package | com.fileitup.fisixengine.primitives |
Class | public class Particle |
Inheritance | Particle ![]() |
Subclasses | CircleParticle, GuideParticle, PolygonParticle |
Dynamic objects are objects that move around and have physical properties such as velocity, mass, friction, etc.
A Particle cannot be added as an object to the engine, but is extended by the following:
- Particle
- CircleParticle
- GuideParticle
- WheelParticle
- Polygon
See also
Property | Defined by | ||
---|---|---|---|
accel : Vector
A vector which stores the current acceleration vector of the object
| Particle | ||
![]() | active : Boolean = true Tells the engine whether or not to treat this object as a part of the simulation
This value may be changed at any time during the simulation | CollisionObject | |
![]() | bounce : Number = .5 The object's coefficient of reinstiturion.
| CollisionObject | |
![]() | collidable : Boolean = true Tells the engine whether or not to check collisions against this object
You may set this value at any time during the sumulation to turn collision detection on/off for this object
| CollisionObject | |
![]() | color : int = -1 The object's rendering color.
| CollisionObject | |
![]() | dynamicObjectCollisions : Boolean = false | CollisionObject | |
![]() | fixed : Boolean A fixed CollisionObject is never influenced by collisions
You may change this value at any time
| CollisionObject | |
![]() | friction : Number = 0 The object's coefficient of friction.
| CollisionObject | |
![]() | inheritAttributesOnAdd : Boolean = true | CollisionObject | |
inverseMass : Number [read-only]Used for engine calculations.
| Particle | ||
![]() | lastCollision : CollisionData
An internal object which stores the information of the object's last collision
| CollisionObject | |
![]() | magnetic : Boolean = true If true, the object is affected by magnets
| CollisionObject | |
mass : Number The mass of the object (between 0 - infinity)
| Particle | ||
![]() | minX : Number Hold the dimensions of the object's bounding box.
| CollisionObject | |
![]() | name : String = "" | CollisionObject | |
old : Vector
A vector which stores the position of the object before the last integration in global space
| Particle | ||
old2 : Vector
A vector representing the object's speed.
| Particle | ||
![]() | parent : FisixObject
The parent of the object.
| CollisionObject | |
pos : Vector
A vector which stores the position of the object in global coordinates
| Particle | ||
![]() | raycast : Boolean An internal property, used by the engine
| CollisionObject | |
![]() | traction : Number = 1 The object's traction.
| CollisionObject | |
![]() | type : String A string representing the type of object you are dealing with
| CollisionObject | |
velocity : Vector | Particle |
Property | Defined by | ||
---|---|---|---|
![]() | detectionMode : int = 0 | CollisionObject | |
maxVel : Number | Particle | ||
![]() | mFixed : Boolean = false | CollisionObject | |
mMass : Number = 1 | Particle | ||
![]() | mMaterial : String | CollisionObject | |
![]() | mStatic : Boolean = false | CollisionObject | |
![]() | myType : String = "" | CollisionObject | |
![]() | reactionMode : int = 0 | CollisionObject | |
![]() | useRaycasting : Boolean = false | CollisionObject |
Method | Defined by | ||
---|---|---|---|
Particle(x:Number, y:Number)
| Particle | ||
![]() |
aabbIntersection(obj:CollisionObject):Boolean
Returns whether or not this object's AABB is intersecting with the given object's AABB
| CollisionObject | |
addVelocity(vel:Vector):void
Allows you to explicitly increase/decrease the velocity of the object.
| Particle | ||
Applies a uniform force, moving the entire object.
| Particle | ||
![]() |
Applies a force at the given point.
| CollisionObject | |
clone():Object
| Particle | ||
dispose():void
| Particle | ||
distanceSquaredTo(d:Particle):Number
Calculates the distance squared to another Particle.
| Particle | ||
distanceTo(d:Particle):Number
Calculates the distance to another Particle
| Particle | ||
![]() |
fireAfterCollision():void
| CollisionObject | |
![]() |
fireOnCollision():void
| CollisionObject | |
![]() |
fix(f:Boolean = true):void
Another way of setting the value 'fixed'.
| CollisionObject | |
![]() |
getDetectionMode():int
| CollisionObject | |
![]() |
getMaterial():String
The name of the current material applied to the object
| CollisionObject | |
![]() |
getNormalAngleAt(p:Vector):Number
| CollisionObject | |
![]() | CollisionObject | ||
![]() |
getReactionMode():int
| CollisionObject | |
integrate(dt:Number = 1):void
Integrates the object.
| Particle | ||
![]() |
isStatic():Boolean
Returns a value indicating whether or not this object was made static.
| CollisionObject | |
![]() |
makeStatic():void
Makes the object static.
| CollisionObject | |
move(mX:Number, mY:Number):void
Similar to thrust, but does not change the object's velocity
| Particle | ||
moveTo(mX:Number, mY:Number, ease:Number = 1):void
| Particle | ||
![]() |
onInit():void
Called after the object is initiated by a FisixObject to which it was added
| CollisionObject | |
pointForce(point:Vector, force:Number):void
| Particle | ||
![]() |
render(g:Graphics):void
Renders a primitive shape of the object to the given Graphics object.
| CollisionObject | |
![]() |
renderBoundingBox(g:Graphics):void
Renders a rectangle representing the bounding box to the graphics object
| CollisionObject | |
rotationalForce(deg:Number, center:Vector):void
Applies a force vector derived from the given angle value
| Particle | ||
rotationalThrust(deg:Number, center:Vector):void
Thrusts the object with a vector derived from the given angle value
| Particle | ||
![]() |
setDetectionMode(m:int):void
Sets the collision detection mode to be used by the object
| CollisionObject | |
![]() |
setMaterial(mName:String):void
Sets the material of the object
This modifies the object's 'friction', 'bounce', 'color' and 'traction' properties.
| CollisionObject | |
setPosition(tX:Number, tY:Number):void
Sets the position of the object in the given global position and resets it's acceleration and velocity.
| Particle | ||
![]() |
setReactionMode(m:int):void
Sets the collision reaction mode to be used by the object
| CollisionObject | |
setVelocity(vel:Vector, checkAA:Boolean = true):void
Allows you to explicitly set the velocity of the object.
| Particle | ||
solveBoundsCollisions(w:BoundingBox):void
Used to keep the object within the given rectangular boundaries.
| Particle | ||
solveReactions():void
| Particle | ||
Moves the object uniformly with the given x,y values and adds the values to its velocity.
| Particle | ||
![]() |
thrustPoint(tX:Number, tY:Number, p:Vector):void
Unlike thrust which moves the whole object, thrustPoint() hits the object from the given point, with the given x,y values and adds the values to its velocity.
| CollisionObject | |
thrustTo(tX:Number, tY:Number, ease:Number = 1):void
Thrusts the object to the given position in global space
| Particle | ||
thrustVector(v:Vector):void
Same as thrust() but takes in a vector instead of an x and y value
| Particle | ||
![]() |
unload():void
Removes the object from the engine and disposes of it.
| CollisionObject | |
updateBoundingBox():void
Updates the bounding box of the object.
| Particle |
Method | Defined by | ||
---|---|---|---|
![]() |
afterCollision(data:CollisionData):void
Override this function to perform an action after a collision is resolved
| CollisionObject | |
afterIntegrate(dt:Number):void
Override this method to perform checks after the object is integrated on every frame.
| Particle | ||
![]() |
afterUnload():void
Override this method to perform actions after the object has been unloaded.
| CollisionObject | |
beforeIntegrate(dt:Number):void
Override this method to perform checks before the object is integrated on every frame.
| Particle | ||
![]() |
onCollision(data:CollisionData):void
Override this function to perform an action at the time a collision is detected
| CollisionObject | |
![]() |
onUnload():void
Override this method to perform actions once the object is unloaded.
| CollisionObject | |
setMaxVel(v:Number):void
| Particle |
accel | property |
public var accel:Vector
A vector which stores the current acceleration vector of the object
inverseMass | property |
inverseMass:Number
[read-only]Used for engine calculations.
Implementation public function get inverseMass():Number
mass | property |
mass:Number
[read-write]The mass of the object (between 0 - infinity)
Implementation public function get mass():Number
public function set mass(value:Number):void
maxVel | property |
protected var maxVel:Number
mMass | property |
protected var mMass:Number = 1
old | property |
public var old:Vector
A vector which stores the position of the object before the last integration in global space
old2 | property |
public var old2:Vector
A vector representing the object's speed. This vector should never be modified manually.
pos | property |
public var pos:Vector
A vector which stores the position of the object in global coordinates
velocity | property |
public var velocity:Vector
Particle | () | constructor |
public function Particle(x:Number, y:Number)
Parameters
x:Number |
|
y:Number |
addVelocity | () | method |
public function addVelocity(vel:Vector):void
Allows you to explicitly increase/decrease the velocity of the object.
Using may influence the simulation negatively, so instead use applyForce() and thrust()
Parametersvel:Vector |
See also
afterIntegrate | () | method |
protected function afterIntegrate(dt:Number):void
Override this method to perform checks after the object is integrated on every frame.
Note that only active objects are integrated
Parametersdt:Number |
applyForce | () | method |
public override function applyForce(f:Vector, checkAA:Boolean = true):void
Applies a uniform force, moving the entire object. Use this method to simulate simple collision impact. For more physically accurate results, use applyForcePoint()
Parametersf:Vector |
|
checkAA:Boolean (default = true )
|
beforeIntegrate | () | method |
protected function beforeIntegrate(dt:Number):void
Override this method to perform checks before the object is integrated on every frame.
Note that only active objects are integrated
Parametersdt:Number |
clone | () | method |
public function clone():Object
Returns
Object |
dispose | () | method |
public override function dispose():void
distanceSquaredTo | () | method |
public function distanceSquaredTo(d:Particle):Number
Calculates the distance squared to another Particle.
Parametersd:Particle |
Number |
See also
distanceTo | () | method |
public function distanceTo(d:Particle):Number
Calculates the distance to another Particle
Parametersd:Particle |
Number |
integrate | () | method |
public function integrate(dt:Number = 1):void
Integrates the object. This is an internal methods that's called on every frame--calling it manually will probably have no positive affects.
If you would like to perform checks every time the object move, do not override this method. Instead override beforeIntegrate() and afterIntegrate().
dt:Number (default = 1 ) — the amount of times in seconds to integrate.
|
See also
move | () | method |
public function move(mX:Number, mY:Number):void
Similar to thrust, but does not change the object's velocity
ParametersmX:Number |
|
mY:Number |
See also
moveTo | () | method |
public function moveTo(mX:Number, mY:Number, ease:Number = 1):void
Parameters
mX:Number |
|
mY:Number |
|
ease:Number (default = 1 )
|
pointForce | () | method |
public override function pointForce(point:Vector, force:Number):void
Parameters
point:Vector |
|
force:Number |
rotationalForce | () | method |
public function rotationalForce(deg:Number, center:Vector):void
Applies a force vector derived from the given angle value
Parametersdeg:Number — The degree value to thrust the object by
|
|
center:Vector — A point in global space to use as the object's center when rotating.
Using the object's coordinates will yield no results.
|
rotationalThrust | () | method |
public function rotationalThrust(deg:Number, center:Vector):void
Thrusts the object with a vector derived from the given angle value
Parametersdeg:Number — The degree value to thrust the object by
|
|
center:Vector — A point in global space to use as the object's center when rotating.
Using the object's coordinates will yield no results.
|
setMaxVel | () | method |
protected function setMaxVel(v:Number):void
Parameters
v:Number |
setPosition | () | method |
public function setPosition(tX:Number, tY:Number):void
Sets the position of the object in the given global position and resets it's acceleration and velocity.
ParameterstX:Number |
|
tY:Number |
setVelocity | () | method |
public function setVelocity(vel:Vector, checkAA:Boolean = true):void
Allows you to explicitly set the velocity of the object.
Using may influence the simulation negatively, so instead use applyForce() and thrust()
Parametersvel:Vector |
|
checkAA:Boolean (default = true )
|
See also
solveBoundsCollisions | () | method |
public function solveBoundsCollisions(w:BoundingBox):void
Used to keep the object within the given rectangular boundaries. This is an internal method that shouldn't be called manually.
Parametersw:BoundingBox |
solveReactions | () | method |
public override function solveReactions():void
thrust | () | method |
public override function thrust(tX:Number, tY:Number, checkAA:Boolean = true):void
Moves the object uniformly with the given x,y values and adds the values to its velocity. Refrain from using this method to avoid penetration. Instead, use applyForce()
ParameterstX:Number |
|
tY:Number |
|
checkAA:Boolean (default = true )
|
thrustTo | () | method |
public function thrustTo(tX:Number, tY:Number, ease:Number = 1):void
Thrusts the object to the given position in global space
ParameterstX:Number — Global x position to move the object to.
|
|
tY:Number — Global y position to move the object to.
|
|
ease:Number (default = 1 ) — The higher this value, the more time it takes the object to reach it's target postion (acts like a damper).This is very usefull when manually attaching an object to the mouse. |
thrustVector | () | method |
public function thrustVector(v:Vector):void
Same as thrust() but takes in a vector instead of an x and y value
Parametersv:Vector |
See also
updateBoundingBox | () | method |
public override function updateBoundingBox():void
Updates the bounding box of the object. This is an internal methods that is called many times a frame. Calling it manually won't do much.