Class TriangleEdgeCollisionFilter
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 collisions are discarded.
public class TriangleEdgeCollisionFilter : INarrowPhaseFilter
- Inheritance
-
TriangleEdgeCollisionFilter
- Implements
- Inherited Members
Properties
AngleThreshold
Gets or sets the angle threshold for determining when two triangle normals are considered identical.
public JAngle AngleThreshold { get; set; }
Property Value
- JAngle
The default value is approximately 2.5 degrees.
Remarks
When a collision occurs near an edge, this threshold determines whether the current triangle and its neighbor are treated as coplanar (same normal) or as forming a crease. Coplanar neighbors use simpler normal snapping logic.
This threshold is also used to detect and discard back-face collisions: if the collision normal points within this angle of being anti-parallel to the triangle normal, the collision is filtered out.
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
Collision points closer than this distance to a triangle edge are considered edge collisions and may have their normals adjusted or be discarded. Larger values are more aggressive at filtering edges but may incorrectly affect legitimate collisions near triangle boundaries.
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. Such collisions are discarded as they typically represent internal edge artifacts.
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
shapeARigidBodyShapeThe first shape in the collision.
shapeBRigidBodyShapeThe second shape in the collision.
pointAJVectorContact point on shape A (modifiable).
pointBJVectorContact point on shape B (modifiable).
normalJVectorCollision normal from B to A (modifiable).
penetrationfloatPenetration depth (modifiable).
Returns
- bool
trueto keep the collision;falseto discard it.