Correcting angular velocities in an angular constraint
Posted: Sun Feb 21, 2016 4:09 am
Hello.
I'm implementing a physics engine with rigid bodies with constraints using Baltman and Radeztsky's article: http://twvideo01.ubm-us.net/o1/vault/gd ... ration.pdf
I want to speak about angle constraint between two bodies (section 8 ). The idea is as follows. We determine a relative orientation of a body B relative to a body A: we calculate a corresponding quaternion (\delta q^a_body = \bar q^a (q^b \bar q^a) q^a). Then if it does not satisfy angular constraints (which constraint imaginary components of the relative orientation quaternion \delta q^a_body s.t. sin(minXangle/2) <= \delta q^a_body.x <= sin(maxXangle/2) and so on), we divide the corresponding correction between bodies so the constraint to be satisfied.
It is also good to change angular velocities. To do this we're implementing "an angular collision" (formulas 8.11, 8.12). And here comes the question. To get satisfactory results we need to implement a collision only if angular velocities are making constraint violation worse and do nothing if angular velocities are already making situation better, aren't we? How can I determine if it is the case?
What came first into my mind is to just calculate a derivative of the \delta q^a_body and consider angular velocities "bad" if \delta q^a_body.x < sin(minXangle/2) and d/dt(\delta q^a_body.x).x < 0 (or similar to y and z). This is indeed a correct test whether angular velocities are "bad". But the result is not satisfactory because when we're implementing "an angular collision" we're changing all components of angular velocities, even that should be unchanged (e.g. when we're implementing a distance constraint -- rigid rod between particles -- we should correct only longitudinal velocities components keeping normal velocities components unchanged). How can I decide "which components of angular velocities" should I change?
I'm implementing a physics engine with rigid bodies with constraints using Baltman and Radeztsky's article: http://twvideo01.ubm-us.net/o1/vault/gd ... ration.pdf
I want to speak about angle constraint between two bodies (section 8 ). The idea is as follows. We determine a relative orientation of a body B relative to a body A: we calculate a corresponding quaternion (\delta q^a_body = \bar q^a (q^b \bar q^a) q^a). Then if it does not satisfy angular constraints (which constraint imaginary components of the relative orientation quaternion \delta q^a_body s.t. sin(minXangle/2) <= \delta q^a_body.x <= sin(maxXangle/2) and so on), we divide the corresponding correction between bodies so the constraint to be satisfied.
It is also good to change angular velocities. To do this we're implementing "an angular collision" (formulas 8.11, 8.12). And here comes the question. To get satisfactory results we need to implement a collision only if angular velocities are making constraint violation worse and do nothing if angular velocities are already making situation better, aren't we? How can I determine if it is the case?
What came first into my mind is to just calculate a derivative of the \delta q^a_body and consider angular velocities "bad" if \delta q^a_body.x < sin(minXangle/2) and d/dt(\delta q^a_body.x).x < 0 (or similar to y and z). This is indeed a correct test whether angular velocities are "bad". But the result is not satisfactory because when we're implementing "an angular collision" we're changing all components of angular velocities, even that should be unchanged (e.g. when we're implementing a distance constraint -- rigid rod between particles -- we should correct only longitudinal velocities components keeping normal velocities components unchanged). How can I decide "which components of angular velocities" should I change?