Skip to main content
gamedev.net
🔒 Locked

abc

Started by ccherng 1 reply 550+ views
Original Post
ccherng
ccherng
a
Zakwayda
Zakwayda
Quote:
In David Eberly's Game Physics book could someone explain to me how the NoIntersect function on page 318 works?
It's a support function for the separating axis test. First of all, in my edition the first line is 'if (Cfg1.max...)'. I think maybe that should be 'if (info1.max...)', which may be causing you confusion.

Also keep in mind that the function returns true if the intervals/objects are found not to intersect, and false otherwise. This also could be a source of confusion.

The test considers two intervals (on a 1d number line), the first of which is moving and the second of which is stationary. Call the intervals A and B, and let left and right indicate the decreasing and increasing directions of the number line, respectively.

If A is left of B and moving left, no intersection. Else if it is moving right the intervals start and stop intersecting at times > 0. The test may pass or fail depending on what these times are.

Else if A is right of B and moving right, no intersection. Else if it is moving left, same as above.

Else the intervals are intersecting at time 0. The time at which they stop intersecting is determined according to the direction of motion, and the test may pass or fail based on this result. The function tracks additional information for the purpose of reconstructing contact information if the objects are found to intersect.

So that's what this particular function does, but to fully understand it you have to be familiar with the dynamic separating axis test for convex objects.
Zakwayda
Zakwayda
Quote:
Specifically I do not see how David Eberly's code detects that say two 2d boxes at rest are just touching on an entire edge. NoIntersect seems to always return true for that I think. So if you can't identify resting/sliding contact then how can you use LCP to process them?
Do you mean that one box is on top of the other? Presumably the first box would have a 'downwards' non-zero velocity with respect to the second due to gravity. The swept SAT test would then return the first time of intersection as zero, and the contact points would be the endpoints of the intersection of the adjacent box edges, like this (the * are the contact points):
-------------|           ||           |---*--------*----   |            |   |            |   --------------
In practice, robustly processing resting contacts, i.e. 'stacking', can be tricky.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.