Sign in to follow this  
phoenix07p

Limit Rotation about an axis

Recommended Posts

Hi, I want to create a simple bike( box with 2 wheels). I am using Physx SDK with directx in c++. I managed to make it but the problem as expected is it topples over when trying to turn. I wanted to ask if there was a way to limit the rotation of a body (if I can get its rotation matrix or quaternion) about the known forward direction of the body. I basically want to limit rotation to about PI/4 on each sides. Also are there any bike examples available for Physx i only found simple cars. Thanks.

Share this post


Link to post
Share on other sites
Havok has a bike example. You need to apply a torque to the body to counter hte torque that's causing it to topple. You'll want to rig up some kind of controller, such as a PID controller to respond to the displacement in angle and to compute the torque to apply.

But for starters you just need to find the torque caused by the cornering force being applied at the offset from the center of mass (it's applied at the tire patch) and apply an equal and opposite torque. (this is done on a real bike by counter steering to lean the bike into the corner so that the cornering torque is countered by the torque of gravity pulling the center of mass down about the same torque arm).

Apply an equal and opposite torque will drift though, which is why you want a slightly more complicated controller.

Share this post


Link to post
Share on other sites
Thanks for replying.

I too thought about that but I found no way to get the current torque on an object(i may have missed it but if i remember correctly i could in ODE). So i looked up the example in havok it actually has a joint made with the ground that limits rotation w.r.t. to it. did the same and worked.

Thanks again.

Share this post


Link to post
Share on other sites
Yea i didnt mean to "get" the current torque. I meant to compute it. If you know the acceleration of the body and you can assume it's from the contact patch then you can "compute" the current torque.

But, i'm glad you found a solution.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this