Table of Contents

Class TriangleEdgeCollisionFilter

Namespace
Jitter2.Collision
Assembly
Jitter2.dll

Filters internal edge collisions for TriangleShape geometry. Adjusts collision normals at shared edges to match neighboring triangles, or discards the collision if the normal cannot be resolved. Requires triangle adjacency information; boundary edges (no neighbor) are left unmodified. Back-face normals within AngleThreshold of the opposite triangle normal are discarded.

public class TriangleEdgeCollisionFilter : INarrowPhaseFilter
Inheritance
TriangleEdgeCollisionFilter
Implements
Inherited Members

Properties

AngleThreshold

Gets or sets the angle threshold used for two purposes: determining when two triangle normals are considered coplanar (using simpler snapping logic), and discarding back-face collisions whose normal is anti-parallel to the triangle normal within this angle.

public JAngle AngleThreshold { get; set; }

Property Value

JAngle

The default value is approximately 2.5 degrees.

EdgeThreshold

Gets or sets the distance threshold for edge collision detection, in world units.

public float EdgeThreshold { get; set; }

Property Value

float

The default value is 0.01 world units.

Remarks

Larger values are more aggressive at filtering edges but may incorrectly affect legitimate collisions near triangle boundaries.

FilterDynamicBodies

Gets or sets whether dynamic triangle bodies receive edge filtering. Static and kinematic triangle geometry is always filtered. Defaults to false.

public bool FilterDynamicBodies { get; set; }

Property Value

bool

ProjectionThreshold

Gets or sets the minimum length of the projected collision normal required to keep the contact.

public float ProjectionThreshold { get; set; }

Property Value

float

The default value is 0.5.

Remarks

When the collision normal is projected onto the plane formed by the triangle normal and its neighbor's normal, a very short projection indicates the collision is occurring along the edge crease itself and is discarded. Lower values allow more edge collisions through; higher values are more aggressive at filtering.

Methods

Filter(RigidBodyShape, RigidBodyShape, ref JVector, ref JVector, ref JVector, ref float)

Called for each detected collision with its contact data.

public bool Filter(RigidBodyShape shapeA, RigidBodyShape shapeB, ref JVector pointA, ref JVector pointB, ref JVector normal, ref float penetration)

Parameters

shapeA RigidBodyShape

The first shape in the collision.

shapeB RigidBodyShape

The second shape in the collision.

pointA JVector

Contact point on shape A (modifiable).

pointB JVector

Contact point on shape B (modifiable).

normal JVector

Collision normal used to solve the contact (modifiable). A positive normal impulse pushes shape B along this direction and shape A against it.

penetration float

Signed penetration depth reported by the narrowphase. Changes to this value alone do not affect the registered contact; its separation is derived from the contact points and normal.

Returns

bool

true to keep the collision; false to discard it.