Class TriangleEdgeCollisionFilter
Reduces snagging on shared edges of TriangleShape meshes.
public class TriangleEdgeCollisionFilter : INarrowPhaseFilter
- Inheritance
-
TriangleEdgeCollisionFilter
- Implements
- Inherited Members
Remarks
Adjusts or discards contacts near shared edges using the mesh's neighboring triangles. Boundary edges are left unchanged. Contacts directed into the back face within AngleThreshold of the reversed triangle normal are discarded.
Properties
AngleThreshold
Gets or sets the angle tolerance for treating neighboring triangles as coplanar and for rejecting contacts directed into a triangle's back face.
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
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
shapeARigidBodyShapeThe first shape in the collision.
shapeBRigidBodyShapeThe second shape in the collision.
pointAJVectorContact point on shape A in world space. May be modified.
pointBJVectorContact point on shape B in world space. May be modified.
normalJVectorCollision normal in world space. May be modified. The contact pushes shape B along this direction and shape A against it.
penetrationfloatSigned penetration depth. Changing this value alone does not change the contact response; that is determined by the contact points and normal.
Returns
- bool
trueto keep the collision;falseto discard it.