PackageBox2DAS.Dynamics
Classpublic class ContactEvent
InheritanceContactEvent Inheritance flash.events.Event

A native flash event class for handling Box2d contact events. If a fixture's user data implements IEventDispatcher (for example, if m_userData is a MovieClip), that event dispatcher will be used to broadcast contact events involving the fixture. GOTCHA: A fixture will only dispatch contact events if reportBeginContact, reportEndContact, etc. are set to true.



Public Properties
 PropertyDefined By
  BEGIN_CONTACT : String = onBeginContact
[static]
ContactEvent
  bias : int
ContactEvent
  contact : b2Contact
ContactEvent
  END_CONTACT : String = onEndContact
[static]
ContactEvent
  fixture : b2Fixture
ContactEvent
  impulses : b2ContactImpulse
ContactEvent
  normal : V2
[read-only] Get the world normal of the contact that points from fixture to other.
ContactEvent
  oldManifold : b2Manifold
ContactEvent
  other : b2Fixture
ContactEvent
  point : V2
[read-only] Get the world point of contact (for 2-point contacts, this is the average).
ContactEvent
  pointCount : uint
[read-only] Get the point count from the contact.
ContactEvent
  POST_SOLVE : String = onPostSolve
[static]
ContactEvent
  PRE_SOLVE : String = onPreSolve
[static]
ContactEvent
  relatedObject : *
ContactEvent
  world : b2World
ContactEvent
  worldManifold : b2WorldManifold
ContactEvent
  worldManifoldTime : int
ContactEvent
Public Methods
 MethodDefined By
  
ContactEvent(t:String, c:b2Contact, bi:int, o:b2Manifold = null, i:b2ContactImpulse = null)
ContactEvent
  
applyForce(base:Number, massFactor:Number = 0, self:Boolean = false):void
Applies a force to the other body in the direction of the normal.
ContactEvent
  
applyImpulse(base:Number, massFactor:Number = 0):void
Applies an impulse to the other body in the direction of the normal.
ContactEvent
  
clone():Event
[override] Clone the event for re-dispatching.
ContactEvent
  
Returns the world manifold.
ContactEvent
  
isSolid():Boolean
Returns true if the contacts is touching, is not a sensor, and has not been disabled.
ContactEvent
  
[override] Disables a contact by setting it as a sensor for the life of the contact.
ContactEvent
  
update():void
Update the contact.
ContactEvent
Property Detail
BEGIN_CONTACTproperty
public static var BEGIN_CONTACT:String = onBeginContact

biasproperty 
public var bias:int

contactproperty 
public var contact:b2Contact

END_CONTACTproperty 
public static var END_CONTACT:String = onEndContact

fixtureproperty 
public var fixture:b2Fixture

impulsesproperty 
public var impulses:b2ContactImpulse

normalproperty 
normal:V2  [read-only]

Get the world normal of the contact that points from fixture to other.


Implementation
    public function get normal():V2
oldManifoldproperty 
public var oldManifold:b2Manifold

otherproperty 
public var other:b2Fixture

pointproperty 
point:V2  [read-only]

Get the world point of contact (for 2-point contacts, this is the average).


Implementation
    public function get point():V2
pointCountproperty 
pointCount:uint  [read-only]

Get the point count from the contact.


Implementation
    public function get pointCount():uint
POST_SOLVEproperty 
public static var POST_SOLVE:String = onPostSolve

PRE_SOLVEproperty 
public static var PRE_SOLVE:String = onPreSolve

relatedObjectproperty 
public var relatedObject:*

worldproperty 
public var world:b2World

worldManifoldproperty 
public var worldManifold:b2WorldManifold

worldManifoldTimeproperty 
public var worldManifoldTime:int

Constructor Detail
ContactEvent()Constructor
public function ContactEvent(t:String, c:b2Contact, bi:int, o:b2Manifold = null, i:b2ContactImpulse = null)



Parameters
t:String
 
c:b2Contact
 
bi:int
 
o:b2Manifold (default = null)
 
i:b2ContactImpulse (default = null)
Method Detail
applyForce()method
public function applyForce(base:Number, massFactor:Number = 0, self:Boolean = false):void

Applies a force to the other body in the direction of the normal.

Parameters

base:Number
 
massFactor:Number (default = 0)
 
self:Boolean (default = false)

applyImpulse()method 
public function applyImpulse(base:Number, massFactor:Number = 0):void

Applies an impulse to the other body in the direction of the normal.

Parameters

base:Number
 
massFactor:Number (default = 0)

clone()method 
override public function clone():Event

Clone the event for re-dispatching.

Returns
Event
getWorldManifold()method 
public function getWorldManifold():b2WorldManifold

Returns the world manifold. Very important if you plan on actually doing anything significant with contacts. The normal will be oriented based on "bias" so that it is always pointing from the target fixture to the other fixture. This way you don't have to worry about the direction of the normal.

Returns
b2WorldManifold
isSolid()method 
public function isSolid():Boolean

Returns true if the contacts is touching, is not a sensor, and has not been disabled.

Returns
Boolean
preventDefault()method 
override public function preventDefault():void

Disables a contact by setting it as a sensor for the life of the contact.

update()method 
public function update():void

Update the contact. This ensures the contact has the right, current information.