C# Class Jitter.Collision.CollisionSystem

CollisionSystem. Used by the world class to detect all collisions. Can be used seperatly from the physics.
Mostrar archivo Open project: tpb3d/TPB3D Class Usage Examples

Public Methods

Method Description
AddEntity ( IBroadphaseEntity body ) : void

Add a body to the collision system. Adding a body to the world does automatically add it to the collision system.

CheckBothStaticOrInactive ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool

Checks the state of two bodies.

CheckBoundingBoxes ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool

Checks the AABB of the two rigid bodies.

CollisionSystem ( ) : System

Initializes a new instance of the CollisionSystem.

Detect ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : void

Checks two bodies for collisions using narrowphase.

Detect ( bool multiThreaded ) : void

Tells the collisionsystem to check all bodies for collisions. Hook into the PassedBroadphase and CollisionDetected events to get the results.

FindNearestTrianglePoint ( SoftBody sb, int id, Jitter.LinearMath.JVector &point ) : int
RaisePassedBroadphase ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool

Raises the PassedBroadphase event.

RaisePassedNarrowphase ( RigidBody body1, RigidBody body2, Jitter.LinearMath.JVector &point, Jitter.LinearMath.JVector &normal, float penetration ) : bool

Raises the PassedNarrowphase event.

Raycast ( Jitter.LinearMath.JVector rayOrigin, Jitter.LinearMath.JVector rayDirection, RaycastCallback raycast, RigidBody &body, Jitter.LinearMath.JVector &normal, float &fraction ) : bool

Sends a ray (definied by start and direction) through the scene (all bodies added). NOTE: For performance reasons terrain and trianglemeshshape aren't checked against rays (rays are of infinite length). They are checked against segments which start at rayOrigin and end in rayOrigin + rayDirection.

Raycast ( RigidBody body, Jitter.LinearMath.JVector rayOrigin, Jitter.LinearMath.JVector rayDirection, Jitter.LinearMath.JVector &normal, float &fraction ) : bool

Raycasts a single body. NOTE: For performance reasons terrain and trianglemeshshape aren't checked against rays (rays are of infinite length). They are checked against segments which start at rayOrigin and end in rayOrigin + rayDirection.

RemoveEntity ( IBroadphaseEntity body ) : bool

Remove a body from the collision system. Removing a body from the world does automatically remove it from the collision system.

Protected Methods

Method Description
RaiseCollisionDetected ( RigidBody body1, RigidBody body2, Jitter.LinearMath.JVector &point1, Jitter.LinearMath.JVector &point2, Jitter.LinearMath.JVector &normal, float penetration ) : void

Raises the CollisionDetected event.

Private Methods

Method Description
DetectRigidRigid ( RigidBody body1, RigidBody body2 ) : void
DetectSoftRigid ( RigidBody rigidBody, SoftBody softBody ) : void
DetectSoftSoft ( SoftBody body1, SoftBody body2 ) : void
FindSupportPoints ( RigidBody body1, RigidBody body2, Shape shape1, Shape shape2, Jitter.LinearMath.JVector &point, Jitter.LinearMath.JVector &normal, Jitter.LinearMath.JVector &point1, Jitter.LinearMath.JVector &point2 ) : void
SupportMapping ( RigidBody body, Shape workingShape, Jitter.LinearMath.JVector &direction, Jitter.LinearMath.JVector &result ) : void

Method Details

AddEntity() public abstract method

Add a body to the collision system. Adding a body to the world does automatically add it to the collision system.
public abstract AddEntity ( IBroadphaseEntity body ) : void
body IBroadphaseEntity The body to remove.
return void

CheckBothStaticOrInactive() public method

Checks the state of two bodies.
public CheckBothStaticOrInactive ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool
entity1 IBroadphaseEntity The first body.
entity2 IBroadphaseEntity The second body.
return bool

CheckBoundingBoxes() public method

Checks the AABB of the two rigid bodies.
public CheckBoundingBoxes ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool
entity1 IBroadphaseEntity The first body.
entity2 IBroadphaseEntity The second body.
return bool

CollisionSystem() public method

Initializes a new instance of the CollisionSystem.
public CollisionSystem ( ) : System
return System

Detect() public method

Checks two bodies for collisions using narrowphase.
public Detect ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : void
entity1 IBroadphaseEntity
entity2 IBroadphaseEntity
return void

Detect() public abstract method

Tells the collisionsystem to check all bodies for collisions. Hook into the PassedBroadphase and CollisionDetected events to get the results.
public abstract Detect ( bool multiThreaded ) : void
multiThreaded bool If true internal multithreading is used.
return void

FindNearestTrianglePoint() public static method

public static FindNearestTrianglePoint ( SoftBody sb, int id, Jitter.LinearMath.JVector &point ) : int
sb Jitter.Dynamics.SoftBody
id int
point Jitter.LinearMath.JVector
return int

RaiseCollisionDetected() protected method

Raises the CollisionDetected event.
protected RaiseCollisionDetected ( RigidBody body1, RigidBody body2, Jitter.LinearMath.JVector &point1, Jitter.LinearMath.JVector &point2, Jitter.LinearMath.JVector &normal, float penetration ) : void
body1 RigidBody The first body involved in the collision.
body2 RigidBody The second body involved in the collision.
point1 Jitter.LinearMath.JVector
point2 Jitter.LinearMath.JVector
normal Jitter.LinearMath.JVector The normal pointing to body1.
penetration float The penetration depth.
return void

RaisePassedBroadphase() public method

Raises the PassedBroadphase event.
public RaisePassedBroadphase ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool
entity1 IBroadphaseEntity The first body.
entity2 IBroadphaseEntity The second body.
return bool

RaisePassedNarrowphase() public method

Raises the PassedNarrowphase event.
public RaisePassedNarrowphase ( RigidBody body1, RigidBody body2, Jitter.LinearMath.JVector &point, Jitter.LinearMath.JVector &normal, float penetration ) : bool
body1 RigidBody The first body.
body2 RigidBody The second body.
point Jitter.LinearMath.JVector
normal Jitter.LinearMath.JVector
penetration float
return bool

Raycast() public abstract method

Sends a ray (definied by start and direction) through the scene (all bodies added). NOTE: For performance reasons terrain and trianglemeshshape aren't checked against rays (rays are of infinite length). They are checked against segments which start at rayOrigin and end in rayOrigin + rayDirection.
public abstract Raycast ( Jitter.LinearMath.JVector rayOrigin, Jitter.LinearMath.JVector rayDirection, RaycastCallback raycast, RigidBody &body, Jitter.LinearMath.JVector &normal, float &fraction ) : bool
rayOrigin Jitter.LinearMath.JVector
rayDirection Jitter.LinearMath.JVector
raycast RaycastCallback
body RigidBody
normal Jitter.LinearMath.JVector
fraction float
return bool

Raycast() public abstract method

Raycasts a single body. NOTE: For performance reasons terrain and trianglemeshshape aren't checked against rays (rays are of infinite length). They are checked against segments which start at rayOrigin and end in rayOrigin + rayDirection.
public abstract Raycast ( RigidBody body, Jitter.LinearMath.JVector rayOrigin, Jitter.LinearMath.JVector rayDirection, Jitter.LinearMath.JVector &normal, float &fraction ) : bool
body RigidBody
rayOrigin Jitter.LinearMath.JVector
rayDirection Jitter.LinearMath.JVector
normal Jitter.LinearMath.JVector
fraction float
return bool

RemoveEntity() public abstract method

Remove a body from the collision system. Removing a body from the world does automatically remove it from the collision system.
public abstract RemoveEntity ( IBroadphaseEntity body ) : bool
body IBroadphaseEntity The body to remove.
return bool