CollisionDomainUpdate Method (CollisionObject) |
Namespace: DigitalRune.Geometry.Collisions
Exception | Condition |
---|---|
ArgumentNullException | collisionObject is . |
ArgumentException | collisionObject is not in this CollisionDomain. |
This method acts like Update(Single), except that only the contact info for the specified collision object is updated. The update is done with a time step of 0, which means that any timestamps or similar properties (e.g. Lifetime) are not modified.
This method should only be used in special cases - whenever possible Update(Single) should be used instead. The collision detection caches a lot of information to improve performance. By updating only a single collision object the collision detection might remain in an inconsistent state. That is, the collision objects might have contact, but the contact information is missing.
Example 1 of an inconsistent state: collisionObject was the first hit of a ray that stops at first hits (see StopsAtFirstHit). Now collisionObject is moved and does not touch the ray anymore. When Update(CollisionObject) is called in this situation, the collision detection might remain in an inconsistent state. When Update(Single) is called the contact information of collisionObject is updated and the ContactSet between the collisionObject and the ray will be removed. Since the ray is now no longer blocked by the collisionObject it might hit another object. However, the contact information of the ray is not updated.
Example 2 of an inconsistent state: Some collision objects have moved since the last call of Update(Single). collisionObject is moved into contact with one of the moved objects. Now Update(CollisionObject) for collisionObject is called. The broad phase information of collisionObject is updated. But - depending on the type of broad phase algorithm - the broad phase information of the other objects might not be updated. The collision detection uses the cached broad phase information from the previous Update(Single). So the collision detection might not find all contacts for collisionObject.
To sum up: Use this method carefully. Try to use Update(Single) instead. Call this method only if collisionObject is the only object that has moved since the last call of Update(Single).