C# Class Jitter.Collision.CollisionSystem

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

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

Méthode 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 méthode

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.
Résultat void

CheckBothStaticOrInactive() public méthode

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

CheckBoundingBoxes() public méthode

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.
Résultat bool

CollisionSystem() public méthode

Initializes a new instance of the CollisionSystem.
public CollisionSystem ( ) : System
Résultat System

Detect() public méthode

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

Detect() public abstract méthode

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.
Résultat void

FindNearestTrianglePoint() public static méthode

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

RaiseCollisionDetected() protected méthode

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.
Résultat void

RaisePassedBroadphase() public méthode

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

RaisePassedNarrowphase() public méthode

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
Résultat bool

Raycast() public abstract méthode

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
Résultat bool

Raycast() public abstract méthode

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
Résultat bool

RemoveEntity() public abstract méthode

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.
Résultat bool