# Limit Rotation about an axis

This topic is 3123 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 on other sites

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 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.

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 14
• 10
• 25
• 9
• 57
• ### Forum Statistics

• Total Topics
632642
• Total Posts
3007620
• ### Who's Online (See full list)

There are no registered users currently online

×