Package | flare.physics.colliders |
Class | public class Collider |
Inheritance | Collider ![]() |
Implements | flare.physics.IShape |
Subclasses | BoxCollider, MeshCollider, RayCollider, SphereCollider |
See also
Property | Defined By | ||
---|---|---|---|
angularVelocity : Vector3D
The world space aligned angular velocity (only rigid bodies). | Collider | ||
collectContacts : Boolean = false
When set to true, the object stores the contact data objects after each physics.step() call. | Collider | ||
contactData : Vector.<ContactData>
The contact datas information stored after each physics.step() call. | Collider | ||
contactGroups : uint
Stores the groups in which this collider has been involved during the last physics.step() call. | Collider | ||
displacement : Vector3D
The world space object displacement used for correcting the position of overlaping objects. | Collider | ||
enabled : Boolean = true
Enable or disable the collider. | Collider | ||
friction : Number = 1.0
The friction of the collider from 0 - no friction, to 1 - full friction (only rigid bodies). | Collider | ||
gravity : Vector3D
The gravity vector. | Collider | ||
groups : uint = 1
Sets or gets the collision groups for each collider. | Collider | ||
invInertia : Matrix3D
The world space inverted inertia matrix. | Collider | ||
invLocalInertia : Matrix3D
The inverted local inertia matrix. | Collider | ||
invMass : Number = 1
The inverse mass of the collider. | Collider | ||
invTransform : Matrix3D
The inverse world transform matrix. | Collider | ||
isRigidBody : Boolean = false
Sets or gets if the collider behaves as a rigid body. | Collider | ||
isStatic : Boolean = false
Sets or gets if the collider behaves as a static object. | Collider | ||
isTrigger : Boolean = false
Sets or gets if the collider behaves as a trigger. | Collider | ||
linearVelocity : Vector3D
The world space aligned linear velocity (only rigid bodies). | Collider | ||
mass : Number = 1
The mass of the collider. | Collider | ||
maxX : Number = 0
The maximum position along the Z-Axis in world space. | Collider | ||
maxY : Number = 0
The maximum position along the Z-Axis in world space. | Collider | ||
maxZ : Number = 0
The maximum position along the Z-Axis in world space. | Collider | ||
minX : Number = 0
The minimum position along the X-Axis in world space. | Collider | ||
minY : Number = 0
The minimum position along the Y-Axis in world space. | Collider | ||
minZ : Number = 0
The minimum position along the Z-Axis in world space. | Collider | ||
neverSleep : Boolean = false
Gets or sets if the colider is allowed to enter sleeping mode. | Collider | ||
numContacts : int
The number of contact datas after each physics.step() call when collectContacts is set to true. | Collider | ||
orientation : Vector3D
The orientation in world space in quaternion form. | Collider | ||
parent : Collider
The parent collider. | Collider | ||
pivot : Pivot3D
The pivot associated to this collider. | Collider | ||
position : Vector3D
The position in world space. | Collider | ||
restitution : Number = 0.0
The restitution factor of the collider from 0 - no restitution to 1 - full bouncing (only rigid bodies). | Collider | ||
scaledPivot : Boolean = true
When the collider pivot is scaled, set this property to true to properly calculate the collider transforms. | Collider | ||
shape : int
The shape of the collider. | Collider | ||
sleeping : Boolean = false
Gets or sets whatever the collider is in sleeping mode or not. | Collider | ||
sleepingFactor : Number = 0.9
A factor property which defines how fast the object will enter in sleeping mode, from 0 to 1. | Collider | ||
transform : Matrix3D
The world space transform matrix. | Collider |
Method | Defined By | ||
---|---|---|---|
Collider()
Creates a new Collider object. | Collider | ||
applyImpulse(x:Number, y:Number, z:Number, position:Vector3D = null):void
Applies an impulse force on the collider in world space (only rigid bodies). | Collider | ||
applyLocalImpulse(x:Number, y:Number, z:Number, position:Vector3D = null):void
Applies an impulse force on the collider in local space (only rigid bodies). | Collider | ||
applyLocalTorque(x:Number, y:Number, z:Number):void
Applies a torque force on the collider in local space (only rigid bodies). | Collider | ||
applyTorque(x:Number, y:Number, z:Number):void
Applies a torque force on the collider in world space (only rigid bodies). | Collider | ||
awake():void
Exit spleeing mode. | Collider | ||
Clone this collider. | Collider | ||
constrainLocalRotation(x:Number = 1, y:Number = 1, z:Number = 1):void
Allows for constraining rotation angles (only rigid bodies). | Collider | ||
dispose():void
Disposes all resources used by this collider. | Collider | ||
getSupportPoints(axis:Vector3D, out:Vector.<Vector3D>):int
Get the support points along an arbitraty axis. | Collider | ||
Projects the object along an arbitrary axis. | Collider | ||
resetVelocities():void
Resets both, linear and angular velocities (only rigid bodies). | Collider | ||
setMass(mass:Number):void
Sets the collider mass and inertia for collisions and physics. | Collider | ||
sleep():void
Enters in sleeping mode. | Collider | ||
update(timeStep:Number):void
Updates the state of the collider properties such as its position, orientation, matrices, boundings. | Collider | ||
updateInertia():void
When multiple colliders are grouped to a parent collider, the parent collider must update its mass and intertia values. | Collider |
Constant | Defined By | ||
---|---|---|---|
SHAPE_BOX : int [static] | Collider | ||
SHAPE_MESH : int [static] | Collider | ||
SHAPE_NULL : int [static] | Collider | ||
SHAPE_RAY : int [static] | Collider | ||
SHAPE_SPHERE : int [static] | Collider |
angularVelocity | property |
public var angularVelocity:Vector3D
The world space aligned angular velocity (only rigid bodies).
collectContacts | property |
public var collectContacts:Boolean = false
When set to true, the object stores the contact data objects after each physics.step() call. The contacts are stored in the contactData vector.
See also
contactData | property |
public var contactData:Vector.<ContactData>
The contact datas information stored after each physics.step() call. Because ContactData objects are reused all the time for this or other objects, use the numContacts property to know how many contacts are stored in the vector. Accessing invalid contacts may contain dirty information from previous frames or even other objects, thus, do not store these references between step() calls.
See also
contactGroups | property |
public var contactGroups:uint
Stores the groups in which this collider has been involved during the last physics.step() call. It is a more lightly way to know against what kind of objects this collider has collided than using collectContacts.
See also
displacement | property |
public var displacement:Vector3D
The world space object displacement used for correcting the position of overlaping objects.
enabled | property |
public var enabled:Boolean = true
Enable or disable the collider.
friction | property |
public var friction:Number = 1.0
The friction of the collider from 0 - no friction, to 1 - full friction (only rigid bodies).
gravity | property |
public var gravity:Vector3D
The gravity vector. By default it is set to a physics.gravity reference. To change this value, set it to a new Vector3D. changing the vector directly, will affect the gravity of all other objects using the same reference.
groups | property |
public var groups:uint = 1
Sets or gets the collision groups for each collider.
There are 32 groups available. Colliders can be set to one or multiple groups.
Only objects within the same groups will be afected each other. If two objects do not have any group in common, all collisions will be ignored between them.
Valid group numbers are 1, 2, 4, 8, 16, 32, etc.. and the sum between them to assing multiple groups (1 + 2), (1 + 4), (2 + 8), (1 + 8 + 16), etc... A value of 0 means it is not within any collision group.
By default all colliders are set to group 1.
invInertia | property |
public var invInertia:Matrix3D
The world space inverted inertia matrix.
invLocalInertia | property |
public var invLocalInertia:Matrix3D
The inverted local inertia matrix.
invMass | property |
public var invMass:Number = 1
The inverse mass of the collider. This value is used for kinematic and rigid bodies. To change the mass use setMass() method, do not change this value directly!.
See also
invTransform | property |
public var invTransform:Matrix3D
The inverse world transform matrix.
isRigidBody | property |
public var isRigidBody:Boolean = false
Sets or gets if the collider behaves as a rigid body. Rigid bodies act and react againts different forces like gravity, torque and impulses.
See also
isStatic | property |
public var isStatic:Boolean = false
Sets or gets if the collider behaves as a static object. Static objects can not be move by any rigid body or kinematic objects, but they can still be moved manually through its pivot or position / orientation.
See also
isTrigger | property |
public var isTrigger:Boolean = false
Sets or gets if the collider behaves as a trigger. Trigger objects does not have any reaction to collisions, but can report contacts. They are commonly used to trigger events.
See also
linearVelocity | property |
public var linearVelocity:Vector3D
The world space aligned linear velocity (only rigid bodies).
mass | property |
public var mass:Number = 1
The mass of the collider. This value is used for kinematic and rigid bodies. To change the mass use setMass() method, do not change this value directly!.
See also
maxX | property |
public var maxX:Number = 0
The maximum position along the Z-Axis in world space.
maxY | property |
public var maxY:Number = 0
The maximum position along the Z-Axis in world space.
maxZ | property |
public var maxZ:Number = 0
The maximum position along the Z-Axis in world space.
minX | property |
public var minX:Number = 0
The minimum position along the X-Axis in world space.
minY | property |
public var minY:Number = 0
The minimum position along the Y-Axis in world space.
minZ | property |
public var minZ:Number = 0
The minimum position along the Z-Axis in world space.
neverSleep | property |
public var neverSleep:Boolean = false
Gets or sets if the colider is allowed to enter sleeping mode.
See also
numContacts | property |
public var numContacts:int
The number of contact datas after each physics.step() call when collectContacts is set to true.
See also
orientation | property |
public var orientation:Vector3D
The orientation in world space in quaternion form.
parent | property |
public var parent:Collider
The parent collider. Child colliders are not affected directly by other objects, they just throw their changes (impulses, forces, displacement) to their parents colliders.
pivot | property |
public var pivot:Pivot3D
The pivot associated to this collider.
position | property |
public var position:Vector3D
The position in world space.
restitution | property |
public var restitution:Number = 0.0
The restitution factor of the collider from 0 - no restitution to 1 - full bouncing (only rigid bodies).
scaledPivot | property |
public var scaledPivot:Boolean = true
When the collider pivot is scaled, set this property to true to properly calculate the collider transforms.
shape | property |
public var shape:int
The shape of the collider.
See also
sleeping | property |
public var sleeping:Boolean = false
Gets or sets whatever the collider is in sleeping mode or not.
See also
sleepingFactor | property |
public var sleepingFactor:Number = 0.9
A factor property which defines how fast the object will enter in sleeping mode, from 0 to 1. Smaller values means the collider will enter in sleep mode more quickly.
See also
transform | property |
public var transform:Matrix3D
The world space transform matrix.
Collider | () | Constructor |
public function Collider()
Creates a new Collider object. Empty colliders can be used as a parent for other colliders.
applyImpulse | () | method |
public function applyImpulse(x:Number, y:Number, z:Number, position:Vector3D = null):void
Applies an impulse force on the collider in world space (only rigid bodies).
Parameters
x:Number — X-Axis impulse in world space.
| |
y:Number — Y-Axis impulse in world space.
| |
z:Number — Z-Axis impulse in world space.
| |
position:Vector3D (default = null ) — Position of the impulse in world space. If null, only linear velocity will be affected.
|
applyLocalImpulse | () | method |
public function applyLocalImpulse(x:Number, y:Number, z:Number, position:Vector3D = null):void
Applies an impulse force on the collider in local space (only rigid bodies).
Parameters
x:Number — X-Axis impulse in local space.
| |
y:Number — Y-Axis impulse in local space.
| |
z:Number — Z-Axis impulse in local space.
| |
position:Vector3D (default = null ) — Position of the impulse in local space. If null, only linear velocity will be affected.
|
applyLocalTorque | () | method |
public function applyLocalTorque(x:Number, y:Number, z:Number):void
Applies a torque force on the collider in local space (only rigid bodies).
Parameters
x:Number — X-Axis force in local space.
| |
y:Number — Y-Axis force in local space.
| |
z:Number — Z-Axis force in local space.
|
applyTorque | () | method |
public function applyTorque(x:Number, y:Number, z:Number):void
Applies a torque force on the collider in world space (only rigid bodies).
Parameters
x:Number — X-Axis force in world space.
| |
y:Number — Y-Axis force in world space.
| |
z:Number — Z-Axis force in world space.
|
awake | () | method |
public function awake():void
Exit spleeing mode.
clone | () | method |
constrainLocalRotation | () | method |
public function constrainLocalRotation(x:Number = 1, y:Number = 1, z:Number = 1):void
Allows for constraining rotation angles (only rigid bodies). Values from 0 to infinity. A value of 0 means it can not rotate on certaing angle. A value of 1 menas, it rotates normally, and a higher value than 1 menas it will rotate more slowly.
Parameters
x:Number (default = 1 ) — The X-Axis constraint value.
| |
y:Number (default = 1 ) — The Y-Axis constraint value.
| |
z:Number (default = 1 ) — The Z-Axis constraint value.
|
dispose | () | method |
public function dispose():void
Disposes all resources used by this collider.
getSupportPoints | () | method |
public function getSupportPoints(axis:Vector3D, out:Vector.<Vector3D>):int
Get the support points along an arbitraty axis.
Parameters
axis:Vector3D — The source axis.
| |
out:Vector.<Vector3D> — The result points.
|
int — The number of points.
|
project | () | method |
public function project(axis:Vector3D, info:AxisInfo):void
Projects the object along an arbitrary axis.
Parameters
axis:Vector3D — The axis to project.
| |
info:AxisInfo — The result information.
|
resetVelocities | () | method |
public function resetVelocities():void
Resets both, linear and angular velocities (only rigid bodies).
setMass | () | method |
public function setMass(mass:Number):void
Sets the collider mass and inertia for collisions and physics. invMass will also be calculated.
Parameters
mass:Number — The mass of the collider.
|
sleep | () | method |
public function sleep():void
Enters in sleeping mode.
update | () | method |
public function update(timeStep:Number):void
Updates the state of the collider properties such as its position, orientation, matrices, boundings. If the timeStep is greater than 0, the collider position and orientation will be incremented by its linearVelocity and angularVelocity.
Parameters
timeStep:Number |
updateInertia | () | method |
public function updateInertia():void
When multiple colliders are grouped to a parent collider, the parent collider must update its mass and intertia values.
SHAPE_BOX | Constant |
public static const SHAPE_BOX:int
SHAPE_MESH | Constant |
public static const SHAPE_MESH:int
SHAPE_NULL | Constant |
public static const SHAPE_NULL:int
SHAPE_RAY | Constant |
public static const SHAPE_RAY:int
SHAPE_SPHERE | Constant |
public static const SHAPE_SPHERE:int