Shape

class Shape : System.Object, ISupportMappable

Represents the collision part of the RigidBody. A shape is mainly definied through it’s supportmap. Shapes represent convex objects. Inherited classes have to overwrite the supportmap function. To implement you own shape: derive a class from T:Jitter.Collision.Shapes.Shape, implement the support map function and call ‘UpdateShape’ within the constructor. GeometricCenter, Mass, BoundingBox and Inertia is calculated numerically based on your SupportMap implementation.

readonly JMatrix Inertia

Returns the inertia of the untransformed shape.

readonly float Mass

Gets the mass of the shape. This is the volume. (density = 1)

readonly JBBox BoundingBox

The untransformed axis aligned bounding box of the shape.

System.Object Tag

Allows to set a user defined value to the shape.

public void add_ShapeUpdated(ShapeUpdatedHandler value)
Parameters:
  • value (Jitter.Collision.Shapes.ShapeUpdatedHandler) –
public void remove_ShapeUpdated(ShapeUpdatedHandler value)
Parameters:
  • value (Jitter.Collision.Shapes.ShapeUpdatedHandler) –
public void MakeHull(ref System.Collections.Generic.List<JVector> triangleList, int generationThreshold)
Parameters:
  • (ref) triangleList (System.Collections.Generic.List<JVector>) –
  • generationThreshold (int) –
public void GetBoundingBox(ref JMatrix orientation, ref JBBox box)
Parameters:
  • (ref) orientation (Jitter.LinearMath.JMatrix) –
  • (ref) box (Jitter.LinearMath.JBBox) –
public void UpdateShape()

This method uses the T:Jitter.Collision.ISupportMappable implementation to calculate the local bounding box, the mass, geometric center and the inertia of the shape. In custom shapes this method should be overidden to compute this values faster.

public float CalculateMassInertia(Shape shape, ref JVector centerOfMass, ref JMatrix inertia)
Parameters:
  • shape (Jitter.Collision.Shapes.Shape) –
  • (ref) centerOfMass (Jitter.LinearMath.JVector) –
  • (ref) inertia (Jitter.LinearMath.JMatrix) –
public void CalculateMassInertia()

Numerically calculates the inertia, mass and geometric center of the shape. This gets a good value for “normal” shapes. The algorithm isn’t very accurate for very flat shapes.

public abstract void SupportMapping(ref JVector direction, ref JVector result)
Parameters:
  • (ref) direction (Jitter.LinearMath.JVector) –
  • (ref) result (Jitter.LinearMath.JVector) –
public void SupportCenter(ref JVector geomCenter)
Parameters:
  • (ref) geomCenter (Jitter.LinearMath.JVector) –