C# Класс Jitter.Collision.CollisionSystem

CollisionSystem. Used by the world class to detect all collisions. Can be used seperatly from the physics.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
RaiseCollisionDetected ( RigidBody body1, RigidBody body2, Jitter.LinearMath.JVector &point1, Jitter.LinearMath.JVector &point2, Jitter.LinearMath.JVector &normal, float penetration ) : void

Raises the CollisionDetected event.

Приватные методы

Метод Описание
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

Описание методов

AddEntity() публичный абстрактный Метод

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.
Результат void

CheckBothStaticOrInactive() публичный Метод

Checks the state of two bodies.
public CheckBothStaticOrInactive ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool
entity1 IBroadphaseEntity The first body.
entity2 IBroadphaseEntity The second body.
Результат bool

CheckBoundingBoxes() публичный Метод

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.
Результат bool

CollisionSystem() публичный Метод

Initializes a new instance of the CollisionSystem.
public CollisionSystem ( ) : System
Результат System

Detect() публичный Метод

Checks two bodies for collisions using narrowphase.
public Detect ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : void
entity1 IBroadphaseEntity
entity2 IBroadphaseEntity
Результат void

Detect() публичный абстрактный Метод

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.
Результат void

FindNearestTrianglePoint() публичный статический Метод

public static FindNearestTrianglePoint ( SoftBody sb, int id, Jitter.LinearMath.JVector &point ) : int
sb Jitter.Dynamics.SoftBody
id int
point Jitter.LinearMath.JVector
Результат int

RaiseCollisionDetected() защищенный Метод

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.
Результат void

RaisePassedBroadphase() публичный Метод

Raises the PassedBroadphase event.
public RaisePassedBroadphase ( IBroadphaseEntity entity1, IBroadphaseEntity entity2 ) : bool
entity1 IBroadphaseEntity The first body.
entity2 IBroadphaseEntity The second body.
Результат bool

RaisePassedNarrowphase() публичный Метод

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
Результат bool

Raycast() публичный абстрактный Метод

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
Результат bool

Raycast() публичный абстрактный Метод

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
Результат bool

RemoveEntity() публичный абстрактный Метод

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.
Результат bool