I am working on a simple project and for user manipulation I need to handle collisions between particles and triangles, both moving. The user can drag the particles and there are constraints maintaining them in place (distance constraints). I am using Verlet (basic version) for integration because it's easy to implement constraints and I didn't need anything more advanced.
While the user is dragging the particules (which are moved by the mouse and a distance constraint), I want to be able to handle the collision between the particles of the system and the triangles formed by some of these particles. No particle should be able to pass through the triangles.
Currently, I am using a simple segment-triangle intersection test. The segment being formed by the previous particle position and the current one and using only the current position of the triangle vertices. I tried to use the previous position of the triangle vertices too. The problem is that sometimes even when using both previous and current positions for triangle and particle, I have situations where the whole segment crosses both triangles :
Code: Select all
pc_pp -1 pc_ppp -1 pp_pp -1 pp_ppp -1 cpp False ccp False
pc_pp 1 pc_ppp 1 pp_pp 1 pp_ppp 1 cpp False ccp False
I am currently a little stuck with my method, maybe someone else's perspective could help me. I tried to search for continuous collision detection and found this :
ftp://ftp.cs.ubc.ca/local/techreports/2 ... 009-03.pdf
which explains how to decompose two triangles into 3 tetrahedrons but it uses it for moving edge vs. moving edge tests.
EDIT : I found something here : http://www.geometrictools.com/SamplePhy ... eBody.html
The problem in my case is that because each vertex of the triangles can move independently, I have rotating triangles which can't be handled by the algorithm described here. Also, I read that sweep tests for rotating objects are not well handled in general. Maybe I need to find another solution to the initial problem, if anyone has suggestions.
Thanks!
Rémi.