Stopping the Bike
You have a front and a rear break on a bike, which can be used seperatly and have different effects on the physics.
Using the rear break is the safest way, to stop a bike...and it is the easiest to simulate:
I just simply stop the rotation of the wheel - and due to differnt keyboard layouts this is done with either y or z
The front break reacts a littel different.
As you see, I am not only stopping the wheel, but also check if it's on the ground. If so, a torque is applied to the body, allowing you to do a "stoppy"
Controlling the weight
The last thing I had to simulate was where the bodyweight of the rider sits. Remeber the imagepoints?
Here the global variable scherpunkt is set according to the keypress:
And this concludes the tutorial. You should now have a "working" bike for your projects.
Please let me know, if you need any more information.