net.phys2d.raw
Class CollisionEvent

java.lang.Object
  extended bynet.phys2d.raw.CollisionEvent

public class CollisionEvent
extends java.lang.Object

An event describing a collision between two bodies


Constructor Summary
CollisionEvent(float time, Body body1, Body body2, ROVector2f point, ROVector2f normal, float depth)
          Create a new event describing a contact
 
Method Summary
 Body getBodyA()
          Get the first body in the collision
 Body getBodyB()
          Get the second body in the collision
 ROVector2f getNormal()
          Get the normal at the collision point
 float getPenetrationDepth()
          Get the penetration depth caused by the collision
 ROVector2f getPoint()
          Get the point where the collision occured
 float getTime()
          Get the time of the collision
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollisionEvent

public CollisionEvent(float time,
                      Body body1,
                      Body body2,
                      ROVector2f point,
                      ROVector2f normal,
                      float depth)
Create a new event describing a contact

Parameters:
time - The time of the collision
body1 - The first body in the collision
body2 - The second body in the collision
point - The point of collision (not always perfect - accepts penetration)
normal - The normal of collision
depth - The penetration of of the contact
Method Detail

getTime

public float getTime()
Get the time of the collision

Returns:
The time of the collision

getBodyA

public Body getBodyA()
Get the first body in the collision

Returns:
The first body in the collision

getBodyB

public Body getBodyB()
Get the second body in the collision

Returns:
The second body in the collision

getNormal

public ROVector2f getNormal()
Get the normal at the collision point

Returns:
The normal at the collision point

getPoint

public ROVector2f getPoint()
Get the point where the collision occured

Returns:
The point where the collision occured

getPenetrationDepth

public float getPenetrationDepth()
Get the penetration depth caused by the collision

Returns:
The penetration depth caused by the collision

toString

public java.lang.String toString()
See Also:
Object.toString()