Click or drag to resize
DigitalRuneCollisionDomainGetContacts Method (CollisionObject, CollisionObject)
Gets the contacts for the given CollisionObject pair.

Namespace: DigitalRune.Geometry.Collisions
Assembly: DigitalRune.Geometry (in DigitalRune.Geometry.dll) Version: 1.18.0.0 (1.18.2.14427)
Syntax
public ContactSet GetContacts(
	CollisionObject objectA,
	CollisionObject objectB
)

Parameters

objectA
Type: DigitalRune.Geometry.CollisionsCollisionObject
The first collision object.
objectB
Type: DigitalRune.Geometry.CollisionsCollisionObject
The second collision object.

Return Value

Type: ContactSet
A ContactSet describing the contact information if objectA and objectB are intersecting; otherwise, if the objects are separated.
Exceptions
ExceptionCondition
ArgumentNullExceptionobjectA or objectB is .
Remarks

If both collision objects are part of this CollisionDomain, then this method returns the currently cached contacts sets (which are stored in ContactSets). The contact sets are only updated, when Update(TimeSpan) is called. If the objects have moved since the collision domain was updated last, the contact information will not be up-to-date. In this case you need to call Update(TimeSpan) again before calling GetContacts(CollisionObject) to get up-to-date results.

If one collision object is not part of this CollisionDomain, then this method automatically calculates the new contact information.

If both collision objects are part of this CollisionDomain, then the returned contact sets are managed by the domain. You must not modify or recycle the contact sets! However, if any collision object is not part of this CollisionDomain, the returned contact sets are not managed by the domain. The contact sets can be modified. When they are no longer needed, they should be recycled to avoid unnecessary memory allocations. For example:

Recycling contact sets
foreach (ContactSet contactSet in myCollisionDomain.GetContacts(objectA, objectB))
{
  // Check contact set.
  ...

  Debug.Assert(objectA.Domain != myCollisionDomain || objectB.Domain != myCollisionDomain);
  foreach(var contact in contactSet)
    contact.Recycle();
  contactSet.Recycle();
}
See Also