[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Collision detection Re: Is this list still alive?



On Fri, Jan 12, 2001 at 11:02:00AM +0000, Chris Purnell wrote:
> 
> I intend to use a bounding cylinder.  It needs to be raised slightly above
> the ground to allow for uneven and sloping floors.  Now I just need to work
> out how to do the cylinder/triangle intersection test.
> 

I haven't done all the math, but my guess is that a
cylinder/triangle intersection test would work more or less like
the following:
1) Find two spanning vectors in the triangle (i.e. from one
corner to each of the other two)
2) Make a linear combination of these two vectors that lie on
the surface of the cylinder's side and then the top and bottom
The surface should be fairly simple to describe as a function of
the center of the bottom, the radius and the length, but *errrm*
I'll leave that part to you ;-)
3) Check if the found solution (if any) is actually within the
triangle and on the surface of the cylinder

Without betting my life on it, I think you will end up with an
intersection line (or a point if a corner of the triangle
touches the cylinder) which you should be able to somehow check
in part 3 of the above "algorithm".

Hope it helps,
Skjalm
-- 
It's 21:44:42. Do You Know Where Your Meat Body Is?

---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk
For additional commands, e-mail: linuxgames-help@sunsite.dk