CollisionSystem

class CollisionSystem : System.Object

CollisionSystem. Used by the world class to detect all collisions. Can be used seperatly from the physics.

bool EnableSpeculativeContacts
bool UseTriangleMeshNormal

If set to true the collision system uses the normal of the current colliding triangle as collision normal. This fixes unwanted behavior on triangle transitions.

bool UseTerrainNormal

If set to true the collision system uses the normal of the current colliding triangle as collision normal. This fixes unwanted behavior on triangle transitions.

public abstract bool RemoveEntity(IBroadphaseEntity body)

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

Parameters:
  • body (Jitter.Collision.IBroadphaseEntity) – The body to remove.
Returns:

Returns true if the body was successfully removed, otherwise false.

public abstract void AddEntity(IBroadphaseEntity body)

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

Parameters:
  • body (Jitter.Collision.IBroadphaseEntity) – The body to remove.
public void add_PassedBroadphase(PassedBroadphaseHandler value)
Parameters:
  • value (Jitter.Collision.PassedBroadphaseHandler) –
public void remove_PassedBroadphase(PassedBroadphaseHandler value)
Parameters:
  • value (Jitter.Collision.PassedBroadphaseHandler) –
public void add_CollisionDetected(CollisionDetectedHandler value)
Parameters:
  • value (Jitter.Collision.CollisionDetectedHandler) –
public void remove_CollisionDetected(CollisionDetectedHandler value)
Parameters:
  • value (Jitter.Collision.CollisionDetectedHandler) –
public void Detect(IBroadphaseEntity entity1, IBroadphaseEntity entity2)

Checks two bodies for collisions using narrowphase.

Parameters:
  • entity1 (Jitter.Collision.IBroadphaseEntity) –
  • entity2 (Jitter.Collision.IBroadphaseEntity) –
public int FindNearestTrianglePoint(SoftBody sb, int id, ref JVector point)
Parameters:
  • sb (Jitter.Dynamics.SoftBody) –
  • id (int) –
  • (ref) point (Jitter.LinearMath.JVector) –
public abstract bool Raycast(JVector rayOrigin, JVector rayDirection, RaycastCallback raycast, ref RigidBody body, ref JVector normal, ref float fraction)
Parameters:
  • rayOrigin (Jitter.LinearMath.JVector) –
  • rayDirection (Jitter.LinearMath.JVector) –
  • raycast (Jitter.Collision.RaycastCallback) –
  • (ref) body (Jitter.Dynamics.RigidBody) –
  • (ref) normal (Jitter.LinearMath.JVector) –
  • (ref) fraction (float) –
public abstract bool Raycast(RigidBody body, JVector rayOrigin, JVector rayDirection, ref JVector normal, ref float fraction)
Parameters:
  • body (Jitter.Dynamics.RigidBody) –
  • rayOrigin (Jitter.LinearMath.JVector) –
  • rayDirection (Jitter.LinearMath.JVector) –
  • (ref) normal (Jitter.LinearMath.JVector) –
  • (ref) fraction (float) –
public bool CheckBothStaticOrInactive(IBroadphaseEntity entity1, IBroadphaseEntity entity2)

Checks the state of two bodies.

Parameters:
  • entity1 (Jitter.Collision.IBroadphaseEntity) – The first body.
  • entity2 (Jitter.Collision.IBroadphaseEntity) – The second body.
Returns:

Returns true if both are static or inactive.

public bool CheckBoundingBoxes(IBroadphaseEntity entity1, IBroadphaseEntity entity2)

Checks the AABB of the two rigid bodies.

Parameters:
  • entity1 (Jitter.Collision.IBroadphaseEntity) – The first body.
  • entity2 (Jitter.Collision.IBroadphaseEntity) – The second body.
Returns:

Returns true if an intersection occours.

public bool RaisePassedBroadphase(IBroadphaseEntity entity1, IBroadphaseEntity entity2)

Raises the PassedBroadphase event.

Parameters:
  • entity1 (Jitter.Collision.IBroadphaseEntity) – The first body.
  • entity2 (Jitter.Collision.IBroadphaseEntity) – The second body.
Returns:
Returns false if the collision information

should be dropped

public abstract void Detect(bool multiThreaded)

Tells the collisionsystem to check all bodies for collisions. Hook into the E:Jitter.Collision.CollisionSystem.PassedBroadphase and E:Jitter.Collision.CollisionSystem.CollisionDetected events to get the results.

Parameters:
  • multiThreaded (bool) – If true internal multithreading is used.