Packageverlocity.physics
Classpublic final class PhysObject
InheritancePhysObject Inheritance Object



Public Methods
 MethodDefined By
  
PhysObject(pVelocityDirection:Point, nVelocityMagnitude:Number = 0, nSetMass:Number = 1)
PhysObject
  
_Dispose():void
Clears all physics info.
PhysObject
  
An internal function that removes forces after their life time has expired.
PhysObject
  
AddForce(nTime:Number, pDirection:Point, nMagnitude:Number):void
Adds a force to apply to this physics object
PhysObject
  
AddVelocity(pAddVelocity:Point):void
Adds to the current velocity
PhysObject
  
Returns the number of forces being applied to this physics object.
PhysObject
  
EnableFriction(bEnable:Boolean):void
Enables/disables friction to be applied to this object Default friction will be applied if you do not manually set a friction constant for this object
PhysObject
  
EnableGravity(bEnable:Boolean):void
Enables/disables gravity to be applied to this object Default gravity will be applied if you do not manually set a gravity constant for this object
PhysObject
  
GetDirection():Point
Returns a normalized vector that describes the direction of the current velocity.
PhysObject
  
GetFriction():Point
Returns the friction of this physics object
PhysObject
  
GetGravity():Point
Returns the gravity of this physics object
PhysObject
  
GetMagnitude():Number
Returns the current magnitude (speed)
PhysObject
  
GetMass():Number
Returns the mass of the physics object
PhysObject
  
Returns the calculated sum of all the forces being applied on this physic object
PhysObject
  
GetVelocity():Point
Returns the unit vector of the current velocity
PhysObject
  
GetVX():Number
Returns the current X velocity.
PhysObject
  
GetVY():Number
Returns the current Y velocity.
PhysObject
  
IsAsleep():Boolean
Returns if the physics object is awake or asleep
PhysObject
  
Returns if friction is enabled on this phyics object
PhysObject
  
Returns if gravity is enabled on this phyics object
PhysObject
  
Removes all active forces
PhysObject
  
SetDirection(pDir:Point):void
Sets the velocity direction
PhysObject
  
SetFriciton(pOverrideFriction:Point):void
Sets the friction of this physics object
PhysObject
  
SetGravity(pOverrideGravity:Point):void
Sets the gravity of this physics object (overrides global gravity)
PhysObject
  
SetMagnitude(nMagnitude:Number):void
Sets the magnitude (speed)
PhysObject
  
SetMass(nNewMass:Number):void
Sets the mass of the physics object
PhysObject
  
SetVelocity(pNewVelocity:Point):void
Sets the velocity
PhysObject
  
SetVX(nVelocityX:Number):void
Sets the current X velocity
PhysObject
  
SetVY(nVelocityY:Number):void
Sets the current Y velocity.
PhysObject
  
Sleep():void
Sleeps the physics object (all physics operations will be halted, but not cleared)
PhysObject
  
Resets the friction of this physics object to the global constant
PhysObject
  
Resets the gravity of this physics object to the global constant
PhysObject
  
Wake():void
Wakes up the physics object from sleep
PhysObject
Constructor Detail
PhysObject()Constructor
public function PhysObject(pVelocityDirection:Point, nVelocityMagnitude:Number = 0, nSetMass:Number = 1)



Parameters
pVelocityDirection:Point
 
nVelocityMagnitude:Number (default = 0)
 
nSetMass:Number (default = 1)
Method Detail
_Dispose()method
public function _Dispose():void

Clears all physics info.

_UpdateForces()method 
public function _UpdateForces():void

An internal function that removes forces after their life time has expired.

AddForce()method 
public function AddForce(nTime:Number, pDirection:Point, nMagnitude:Number):void

Adds a force to apply to this physics object

Parameters

nTime:Number — The time to apply (use NaN to apply a constant force)
 
pDirection:Point — The direction of the force (normalized)
 
nMagnitude:Number (default = NaN) — The magnitude or speed to this force will be

AddVelocity()method 
public function AddVelocity(pAddVelocity:Point):void

Adds to the current velocity

Parameters

pAddVelocity:Point

CountForces()method 
public function CountForces():int

Returns the number of forces being applied to this physics object.

Returns
int
EnableFriction()method 
public function EnableFriction(bEnable:Boolean):void

Enables/disables friction to be applied to this object Default friction will be applied if you do not manually set a friction constant for this object

Parameters

bEnable:Boolean — Enable/disable friction

EnableGravity()method 
public function EnableGravity(bEnable:Boolean):void

Enables/disables gravity to be applied to this object Default gravity will be applied if you do not manually set a gravity constant for this object

Parameters

bEnable:Boolean — Enable/disable gravity

GetDirection()method 
public function GetDirection():Point

Returns a normalized vector that describes the direction of the current velocity.

Returns
Point
GetFriction()method 
public function GetFriction():Point

Returns the friction of this physics object

Returns
Point
GetGravity()method 
public function GetGravity():Point

Returns the gravity of this physics object

Returns
Point
GetMagnitude()method 
public function GetMagnitude():Number

Returns the current magnitude (speed)

Returns
Number
GetMass()method 
public function GetMass():Number

Returns the mass of the physics object

Returns
Number
GetSumOfAllForces()method 
public function GetSumOfAllForces():Point

Returns the calculated sum of all the forces being applied on this physic object

Returns
Point
GetVelocity()method 
public function GetVelocity():Point

Returns the unit vector of the current velocity

Returns
Point
GetVX()method 
public function GetVX():Number

Returns the current X velocity.

Returns
Number
GetVY()method 
public function GetVY():Number

Returns the current Y velocity.

Returns
Number
IsAsleep()method 
public function IsAsleep():Boolean

Returns if the physics object is awake or asleep

Returns
Boolean
IsFrictionEnabled()method 
public function IsFrictionEnabled():Boolean

Returns if friction is enabled on this phyics object

Returns
Boolean
IsGravityEnabled()method 
public function IsGravityEnabled():Boolean

Returns if gravity is enabled on this phyics object

Returns
Boolean
RemoveAllForces()method 
public function RemoveAllForces():void

Removes all active forces

SetDirection()method 
public function SetDirection(pDir:Point):void

Sets the velocity direction

Parameters

pDir:Point

SetFriciton()method 
public function SetFriciton(pOverrideFriction:Point):void

Sets the friction of this physics object

Parameters

pOverrideFriction:Point

SetGravity()method 
public function SetGravity(pOverrideGravity:Point):void

Sets the gravity of this physics object (overrides global gravity)

Parameters

pOverrideGravity:Point

SetMagnitude()method 
public function SetMagnitude(nMagnitude:Number):void

Sets the magnitude (speed)

Parameters

nMagnitude:Number

SetMass()method 
public function SetMass(nNewMass:Number):void

Sets the mass of the physics object

Parameters

nNewMass:Number

SetVelocity()method 
public function SetVelocity(pNewVelocity:Point):void

Sets the velocity

Parameters

pNewVelocity:Point

SetVX()method 
public function SetVX(nVelocityX:Number):void

Sets the current X velocity

Parameters

nVelocityX:Number

SetVY()method 
public function SetVY(nVelocityY:Number):void

Sets the current Y velocity.

Parameters

nVelocityY:Number

Sleep()method 
public function Sleep():void

Sleeps the physics object (all physics operations will be halted, but not cleared)

UseDefaultFriction()method 
public function UseDefaultFriction():void

Resets the friction of this physics object to the global constant

UseDefaultGravity()method 
public function UseDefaultGravity():void

Resets the gravity of this physics object to the global constant

Wake()method 
public function Wake():void

Wakes up the physics object from sleep