Assembly: DigitalRune.Geometry (in DigitalRune.Geometry.dll) Version: 1.9.0.0 (1.9.3.9490)
Syntax
| C# |
|---|
[ObfuscationAttribute(Feature = "controlflow")] public sealed class Contact : IRecyclable |
| Visual Basic |
|---|
<ObfuscationAttribute(Feature := "controlflow")> _ Public NotInheritable Class Contact _ Implements IRecyclable |
| Visual C++ |
|---|
[ObfuscationAttribute(Feature = L"controlflow")] public ref class Contact sealed : IRecyclable |
Remarks
A Contact is the result of a collision query. Contacts are usually stored in a ContactSet. A Contact describes a single contact point (or closest-point pair), whereas a ContactSet contains all contacts between two objects. (The involved objects are called "object A" and "object B".)
A Contact includes 2 points: a point on object A (see PositionALocal or PositionAWorld) and a point on object B (see PositionBLocal or PositionBWorld). The property Position is a point that lies halfway between those two points.
There are 4 types of contacts:
- Touching Contact: Object A and object B are touching at the surface. The PenetrationDepth is 0. The points on object A and object B are identical. Position, PositionAWorld, and PositionBWorld are identical.
- Penetrating Contact: Object A and object B are penetrating each other. The PenetrationDepth is greater than 0. PositionAWorld, and PositionBWorld are different and describe the points on object A and B that have maximum penetration. Position lies halfway between these two points.
Closest points (separated objects): Object A and object B are separated. They are not in contact. This can be the result of a closest-point query (see GetClosestPoints(CollisionObject, CollisionObject)). Normal contact queries such as GetContacts(CollisionObject, CollisionObject) or the contact queries performed inside a CollisionDomain ignore separated objects!
The PenetrationDepth is negative. The absolute value of PenetrationDepth indicates the distance between the object A and object B. (The "penetration depth" is the inverse of "separation distance".) PositionAWorld and PositionBWorld are the closest points between the two objects. Position lies halfway between the closest points.
Closest-point query is a special type of collision query. At first this might look confusing: Why does a closest-point query return a Contact? The reason that contacts and closest points are represented by the same class is that the collision detection internally treats contacts and closest points the same way.
Ray Hit: Either object A or object B is a ray that hits the other object. The PenetrationDepth stores the distance from the ray origin to the contact position on the second object. The Normal describes the surface normal at the contact position.
(Ray hits can easily be found by checking whether the property IsRayHit is set in a Contact.)