| Package | com.fileitup.fisixengine.core |
| Class | public class CollisionObject |
| Implements | EngineObject |
| Subclasses | FisixObject, Particle, Surface |
See also
| Property | Defined by | ||
|---|---|---|---|
| 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 | ||
| 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 | ||
| minX : Number Hold the dimensions of the object's bounding box.
| CollisionObject | ||
| name : String = "" | CollisionObject | ||
| parent : FisixObject
The parent of the object.
| CollisionObject | ||
| raycast : Boolean [read-only]An internal property, used by the engine
| CollisionObject | ||
| traction : Number = 1 The object's traction.
| CollisionObject | ||
| type : String [read-only]A string representing the type of object you are dealing with
| CollisionObject | ||
| Property | Defined by | ||
|---|---|---|---|
| detectionMode : int = 0 | CollisionObject | ||
| mFixed : Boolean = false | CollisionObject | ||
| mMaterial : String | CollisionObject | ||
| mStatic : Boolean = false | CollisionObject | ||
| myType : String = "" | CollisionObject | ||
| reactionMode : int = 0 | CollisionObject | ||
| useRaycasting : Boolean = false | CollisionObject | ||
| Method | Defined by | ||
|---|---|---|---|
|
There is no reason to make an instance of this object.
| CollisionObject | ||
|
aabbIntersection(obj:CollisionObject):Boolean
Returns whether or not this object's AABB is intersecting with the given object's AABB
| CollisionObject | ||
|
applyForce(f:Vector, checkAA:Boolean = true):void
Applies a uniform force, moving the entire object.
| CollisionObject | ||
|
Applies a force at the given point.
| CollisionObject | ||
|
dispose():void
| CollisionObject | ||
|
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 | ||
|
isStatic():Boolean
Returns a value indicating whether or not this object was made static.
| CollisionObject | ||
|
makeStatic():void
Makes the object static.
| CollisionObject | ||
|
onInit():void
Called after the object is initiated by a FisixObject to which it was added
| CollisionObject | ||
|
pointForce(point:Vector, force:Number):void
Applies a force value on the object from the given point.
| CollisionObject | ||
|
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 | ||
|
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 | ||
|
setReactionMode(m:int):void
Sets the collision reaction mode to be used by the object
| CollisionObject | ||
|
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.
| CollisionObject | ||
|
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 | ||
|
unload():void
Removes the object from the engine and disposes of it.
| CollisionObject | ||
|
updateBoundingBox():void
Updates the bounding box of the object.
| CollisionObject | ||
| Method | Defined by | ||
|---|---|---|---|
|
afterCollision(data:CollisionData):void
Override this function to perform an action after a collision is resolved
| CollisionObject | ||
|
afterUnload():void
Override this method to perform actions after the object has been unloaded.
| CollisionObject | ||
|
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 | ||
| active | property |
public var active:Boolean = trueTells 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
| bounce | property |
public var bounce:Number = .5The object's coefficient of reinstiturion. changing this value overrides the value set by setMaterial().
See also
| collidable | property |
public var collidable:Boolean = trueTells 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
| color | property |
public var color:int = -1The object's rendering color. changing this value overrides the value set by setMaterial().
See also
| detectionMode | property |
protected var detectionMode:int = 0
| dynamicObjectCollisions | property |
public var dynamicObjectCollisions:Boolean = false
| fixed | property |
fixed:Boolean [read-write]A fixed CollisionObject is never influenced by collisions You may change this value at any time
Implementation public function get fixed():Boolean
public function set fixed(value:Boolean):void
| friction | property |
public var friction:Number = 0The object's coefficient of friction. changing this value overrides the value set by setMaterial().
See also
| inheritAttributesOnAdd | property |
public var inheritAttributesOnAdd:Boolean = true
| lastCollision | property |
public var lastCollision:CollisionDataAn internal object which stores the information of the object's last collision
| magnetic | property |
public var magnetic:Boolean = trueIf true, the object is affected by magnets
| mFixed | property |
protected var mFixed:Boolean = false
| minX | property |
public var minX:NumberHold the dimensions of the object's bounding box. These values should not be set manually
| mMaterial | property |
protected var mMaterial:String
| mStatic | property |
protected var mStatic:Boolean = false
| myType | property |
protected var myType:String = ""
| name | property |
public var name:String = ""
| parent | property |
public var parent:FisixObjectThe parent of the object. this value is automatically set when an object is added to a FisixObject, so refrain from changing it manually
See also
| raycast | property |
raycast:Boolean [read-only]An internal property, used by the engine
Implementation public function get raycast():Boolean
| reactionMode | property |
protected var reactionMode:int = 0
| traction | property |
public var traction:Number = 1The object's traction. changing this value overrides the value set by setMaterial().
See also
| type | property |
type:String [read-only]A string representing the type of object you are dealing with
Implementation public function get type():String
| useRaycasting | property |
protected var useRaycasting:Boolean = false
| CollisionObject | () | constructor |
public function CollisionObject()There is no reason to make an instance of this object. it cannot be added to the engine
| aabbIntersection | () | method |
public function aabbIntersection(obj:CollisionObject):BooleanReturns whether or not this object's AABB is intersecting with the given object's AABB
Parametersobj:CollisionObject |
Boolean |
| afterCollision | () | method |
protected function afterCollision(data:CollisionData):voidOverride this function to perform an action after a collision is resolved
Parametersdata:CollisionData |
See also
| afterUnload | () | method |
protected function afterUnload():voidOverride this method to perform actions after the object has been unloaded. This method is called after the object has been removed from the engine and disposed.
| applyForce | () | method |
public function applyForce(f:Vector, checkAA:Boolean = true):voidApplies 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) |
See also
| applyForcePoint | () | method |
public function applyForcePoint(f:Vector, p:Vector):voidApplies a force at the given point. Note that the point must be in global space
Parametersf:Vector |
|
p:Vector |
| dispose | () | method |
public function dispose():void
| fireAfterCollision | () | method |
public function fireAfterCollision():void
| fireOnCollision | () | method |
public function fireOnCollision():void
| fix | () | method |
public function fix(f:Boolean = true):voidAnother way of setting the value 'fixed'. Note that the default value is true, so writing obj.fix() will set obj.fixed to true.
Parametersf:Boolean (default = true) |
| getDetectionMode | () | method |
public function getDetectionMode():intReturns
int — An integer value representing the object's collision detection mode.
|
See also
| getMaterial | () | method |
public function getMaterial():StringThe name of the current material applied to the object
ReturnsString |
See also
| getNormalAngleAt | () | method |
| getNormalAt | () | method |
public function getNormalAt(p:Vector, dirVector:Vector = null):VectorParameters
p:Vector |
|
dirVector:Vector (default = null) |
Vector |
| getReactionMode | () | method |
public function getReactionMode():intReturns
int — An integer value representing the object's collision reaction mode.
|
See also
| isStatic | () | method |
public function isStatic():BooleanReturns a value indicating whether or not this object was made static.
ReturnsBoolean |
See also
| makeStatic | () | method |
public function makeStatic():voidMakes the object static. Once this function is called, an object cannot be made dynamic again. By calling this you are telling the engine that this object will never move. This helps to optimize collision detection with things like terrains and unmovable obstacles
| onCollision | () | method |
protected function onCollision(data:CollisionData):voidOverride this function to perform an action at the time a collision is detected
Parametersdata:CollisionData |
See also
| onInit | () | method |
public function onInit():voidCalled after the object is initiated by a FisixObject to which it was added
| onUnload | () | method |
protected function onUnload():voidOverride this method to perform actions once the object is unloaded. This method is called before anything is actually unloaded
| pointForce | () | method |
public function pointForce(point:Vector, force:Number):voidApplies a force value on the object from the given point. The farther the object is from the point, the less it is affected.
Parameterspoint:Vector |
|
force:Number |
| render | () | method |
public function render(g:Graphics):voidRenders a primitive shape of the object to the given Graphics object. Usually this method is automatically invoked by the engine, but you may use it to render individual objects.
Parametersg:Graphics |
| renderBoundingBox | () | method |
public function renderBoundingBox(g:Graphics):voidRenders a rectangle representing the bounding box to the graphics object
Parametersg:Graphics — A graphics object to render to
|
| setDetectionMode | () | method |
public function setDetectionMode(m:int):voidSets the collision detection mode to be used by the object
Parametersm:int — an integer representing the collision detection mode.Use the DetectionModes class's constants as a value |
See also
| setMaterial | () | method |
public function setMaterial(mName:String):voidSets the material of the object This modifies the object's 'friction', 'bounce', 'color' and 'traction' properties.
ParametersmName:String — the name of the material as given when the material was created
|
See also
| setReactionMode | () | method |
public function setReactionMode(m:int):voidSets the collision reaction mode to be used by the object
Parametersm:int — an integer representing the collision reaction mode.Use the CollisionModes class's constants as a value |
See also
| thrust | () | method |
public function thrust(tX:Number, tY:Number, checkAA:Boolean = true):voidMoves 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) |
See also
| thrustPoint | () | method |
public function thrustPoint(tX:Number, tY:Number, p:Vector):voidUnlike 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. This is more realistically accurate than thrust(). Refrain from using this method to avoid penetration. Instead, use applyForcePoint()
ParameterstX:Number |
|
tY:Number |
|
p:Vector |
See also
| unload | () | method |
public function unload():voidRemoves the object from the engine and disposes of it. Use this function to cleanly remove an object from the memory
| updateBoundingBox | () | method |
public function updateBoundingBox():voidUpdates 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.