Physical Environment
I found, that the behavior controlls do not help to simulate a natural behavior of a bike, so I added some "gravity" every tick:
As you may notice, I apply a downforce on an imagepoint, that is represented by the global variable schwerpunkt. This is the weight controll described earlier.
These are the vaild imagepoints:
The small upward force, that is applied to the springimagpoint simulates the rear suspension of the bike.
Now, you could let go of the whole thing and it would stand straight on the ground.
Acceleration
When riding a powerfull bike, you have to be carefull, not to flip over if you accelerate to fast. This is due to the torque generated by the engine applie to the back wheel and to the body as well.
This is exactly what I am trying to simulate with the following code:
You can see, that I use the BackTouchSensor to check if the rear wheel is on the ground. If so, and the total velocity of the bike is smaller then 300 torque is also applied to the body of the bike, causing it to rise in the front.
If you remove the speedrestriction, the bike will very easy backflip. You may want to play around with this value!