[ODE] restraining rotation along axes
coding at natew.com
Mon May 13 19:56:01 2002
On Mon, 13 May 2002, Glenn Watson wrote:
> Hi, what is the best way (if it's possible) to ensure
> that a rigid body (say falling under gravity and then
> colliding with static geo) can only rotate around the
> Y axis when it hits something?
Create an invisible body above the body in question. Make the invisible
body immobile (attach it to the static environment), and attach the
falling body to the invisible body with a slider joint.
Check its orientation at each simulation step, and apply a small torque to
try to straighten it out if you notice it leaning along the X or Z axes.
Calculating the proper torque could be tricky. I'd start with something
like "torque_x = gain * (deviation from axis_x)" and the same for the z
axes, then plan to spend a bit of time tuning the gain parameter.
And there's probably other ways. Of those two, the easy way will probably
work *much* better.
Redmond WA USA