Advertisement

torus / triangle collision

Started by November 30, 2002 03:18 AM
3 comments, last by Fantasio 22 years, 2 months ago
Hi... I spend several days of think about moving-rotating torus / triangle Collision, but... unsuccessful. I shearched on google and copernic, but nobody seem to tought about about that... its very usefull for a moto wheel. I''ve already an exact sphere-triangle collision and a torus-triangle collision, by the fact... I tried to test ray of displacement combined with rotation, but it''s not accurate enought.. I tought about Displacement-BBox test but... useless I thought about test triangle-plane(torus normal) in the torus coordinate, thus the triangle rotate... but it''s not better. I''ve my pen and sheet full of test, but without solution... Anyone can help me ? Fantasio
What you''re asking for is pretty complex... Are you sure that you cannot replace it with a simpler method?

Anyway, here''s my take on the problem:

1. Checking if a triangle vertex is inside the torus should not be too complicated by using the cartesian formula (from MathWorld):

(c - sqrt(x² + y²))² + z² < a²

2. To find if an edge intersects the torus, you have to solve the following equation:

(c - sqrt(x² + y²))² + z² = a²

with

x = (x1 - x0)t + x0
y = (y1 - y0)t + y0
z = (z1 - z0)t + z0

By replacing in the first formula. I don''t think that you can easily isolate t, so you have to solve this equation numerically.

Cédric
Advertisement
hmmm... so, how can I test if a moto wheel collision occur ?

I Already have a torus/triangle intesrsection, working with the shere/triangle routine. Simply find the sphere on the torus with:
CrossProduct(CrossProduct(Torus Normal,Face Normal),Torus Normal)*Torus BigRadius;

Torus Normal is the Z Axe, Axe pass trought the hole.

there are an other way than a torus ?



[edited by - fantasio on November 30, 2002 2:28:56 PM]
You are looking for an analytical solution to the moving triangle / moving torus problem? I don''t think that you are going to find it...

Most games don''t work that way. Usually, the object is moved, then collision detection is done. If there is a collision, the time step can be divided into smaller sub-steps to achieve higher precision.

You could replace your torus by a cylinder. Or by a sphere bounded by two planes.

Cédric
Its a moving/rotating torus and a static triangle. But I stoped to think about that. Its too complex. For a only moving torus, its corect.

I make a moto game, and the weels dont rotate on the x or y axe, Only when the moto is tilted.

a torus is a sphere on a circle, and my moving sphere collision is almost perfect.

Fantasio.


[edited by - fantasio on December 2, 2002 1:47:56 PM]

This topic is closed to new replies.

Advertisement