I have read about Position-Based dynamics from this paper but I got a little bit confused on how can I use it to implement collision detection and response. I could follow the math for the case of a distance constrain but it got a bit confusing when trying to apply the same principle to collision.
They mention 2 types of collision detection: continuous and static. The former is when at time t the particle is in the valid zone and in time t+1 is not. The latter is just when at both times the position is invalid and thus the continuous collision detection failed.
To check whether a collision existed I can compute the distance from the particle's position pi to the plane. This is achieved with the following equation (po-pi) . n = d where po is a point in the plane and "n" is the normal of the plane. So far so good.
If I got it correctly I can add a constraint of type unilateral as follows C(pi) = (po-pi) . n >= 0. However, it mentions two conditions.
- If particle pi comes from a valid to an invalid position, compute qc and add an unilateral constraint C(p) = (p-qc) . nc >= 0
- If particle pi has been in an invalid position, compute qs (closest point to pi) and add an unilateral constraint C(p) = (p-qs) . ns >= 0
So, my questions are
1) In the previous constraints what is P ? Is this the point in the plane or the particle's position? Since I know I have to have a point in the plane to be able to compute the distance from the particle to the plane I would say it is a point in the plane, nevertheless, the constraints are applied to the positions of the particles, so my previous statement makes no sense.
2) If I have to compute qc (or qs) then the constrain is solved right? why would I need to create a constraint when I already have the valid point?
3) For any constrain I want my system to be subject to, is the method described like a recipe? What I mean, I just take the constraint, compute the gradient, compute lambda, and then solve iteratively?