Hi
I'm working on a driving game that will include motorbikes. We are not going down the proper simulation route (as nicely described here), rather we are just using a single rigid body simulation and creating an imaginary torque torque (or rather, using a Havok constraint to do this for us) to keep the bike at the right angle.
The question is, how to calculate what angle to lean the bike to?
Now for flat surfaces, this is easy:
LeanAngle = Atan ( 1.0 / LatAcc )
(where LatAcc is in gs and the angle is obtained in radians)
What puzzles me though, is how to take sloped surfaces into account. Now when there is no lateral acceleration, then the bike must be upright (we are not modelling rider movement so that CoG is always laterally central) irrespective of the ground angle.
Throw a corner into the mix though, and things are less obvious, as any sloped road has banked corners. I'm trying to think of an extreme situation, such as when stunt riders ride the wall of death. I'm thinking that, if the corner is helpfully banked (like an oval circuit), you will be leaning more (from a true vertical reference), but do you need to add on the 'camber' of the road, or multiply the above equation, or something else?
Can anyone shed some light on what should be happening and how to mathematically calculate the lean, given I know the vector for the normal to the surface under each tyre? Would be appreciated.
Cheers
Note: I've posted the same question over at RSC
I'm working on a driving game that will include motorbikes. We are not going down the proper simulation route (as nicely described here), rather we are just using a single rigid body simulation and creating an imaginary torque torque (or rather, using a Havok constraint to do this for us) to keep the bike at the right angle.
The question is, how to calculate what angle to lean the bike to?
Now for flat surfaces, this is easy:
LeanAngle = Atan ( 1.0 / LatAcc )
(where LatAcc is in gs and the angle is obtained in radians)
What puzzles me though, is how to take sloped surfaces into account. Now when there is no lateral acceleration, then the bike must be upright (we are not modelling rider movement so that CoG is always laterally central) irrespective of the ground angle.
Throw a corner into the mix though, and things are less obvious, as any sloped road has banked corners. I'm trying to think of an extreme situation, such as when stunt riders ride the wall of death. I'm thinking that, if the corner is helpfully banked (like an oval circuit), you will be leaning more (from a true vertical reference), but do you need to add on the 'camber' of the road, or multiply the above equation, or something else?
Can anyone shed some light on what should be happening and how to mathematically calculate the lean, given I know the vector for the normal to the surface under each tyre? Would be appreciated.
Cheers
Note: I've posted the same question over at RSC