[ODE] Mesh on mesh collisions

Thomas Harte thomasharte at lycos.co.uk
Sun Sep 1 17:21:02 2002


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--=_NextPart_Caramail_0136351030926044_ID
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

I have been writing some mesh on mesh collision functions, and am aware from work 
done before I found ODE that what I need to check for is points against planes and lines 
against lines. However, this is a harder problem than I am used to with ODE, since as 
you will all be aware it doesn't allow any time related functions except a forward 
stepping, meaning that what you must do is survey the scene in order to try and figure 
out what happened, not what is happening. This is made slightly harder in my engine 
because triangles may be two sided, and often are.

In any case, I am considering two approaches, and am wondering if anyone can give me 
any advice, no matter how anecdotal, on these ideas.

Obviously I have some tests that can be used to avert testing when it is obvious no 
collision occurred - that isn't what I want to discuss. I'm talking about when you cannot 
determine absolutely that a collision did not occur and must do the actual lowest test.

Idea 1 is to store old vertex positions myself. In this way, a vertex on triangle collision is 
generated when a vertex has swapped sides of the hyperplane the triangle rests upon, 
and if we assume it moved in a straight line between its start and end point, penetrated 
the triangle. This strikes me as the best I will do for following the logic of 'real life', but 
would require a state based approach with respect to the penalty approach taken to push 
the vertex back to the correct side of the triangle. If the vertex crossed a triangle, I 
would then have to mark the vertex as needing to be pushed back, and only unmark it 
when it had gone back to the original side (which might not happen in one time step). 
This therefore creates a storage problem, since I must worry about maintaining a 
variable number of flags (as a vertex may be colliding with many triangles at any one 
time). This is not hard to solve, but it would be nice to avoid.

Idea 2 is to assume that the vertex has penetrated a triangle if a polygon edge to which 
it is connected penetrates the triangle, and the distance to the vertex from the plane is 
within a certain threshold. This cuts any need for the storage stuff I just spoke about, but 
is notably distinct from any 'real' concept of movement so although I can think of no 
flaws in the idea, may not work exactly as I expect.

Then we have the topic of detecting line on line collisions. Again, two options present 
themselves. The first is to do a simple distance between line check, and if it is below a 
certain threshold (set by me based on knowledge of the time step length and the sort of 
speeds objects in my simulation are capable of), to generate a collision. The problem 
with this approach is that the threshold will noticeably cause lines to 'suck' together if it is 
too large, and will miss collisions if it is too small, so there is plenty of room for mistake.

My second idea is broadly similar to my second vertex idea. In this case, a line on line 
collision is detected if a line on one model crosses a polygon 'near' the edge, and the 
vertex is not within the certain threshold mentioned within my second vertex idea.

Anyway, these are all half formed ideas, and if no-one replies I guess I will just try them 
all until I get something that seems to work, but I thought perhaps someone could push 
me in the right direction?

I appreciate that there are probably ready made solutions for mesh on mesh collisions 
within the framework of ODE, but I'd like to do this for myself, if only out of stubborness! 
That said, any advice on different ready made solutions is gratefully accepted.

-Thomas
______________________________________________________
Check out all the latest outrageous email attachments on the Outrageous Email Chart! - http://viral.lycos.co.uk	


--=_NextPart_Caramail_0136351030926044_ID--