Background
I play with a mini-toy using tr.js and ammo.js, the Bullet Physics conversion library, but I am having some problems making the ball realistic.
(I put the demo at penguinspuzzle.appspot.com/minigolf.html if you want to see how this works in practice.)
Question
What good algorithm gives a more realistic mini-golf ball movement?
What i tried
Ammo.js has options for friction, linear damping, and rotational damping.
When the balls roll, the friction setting does not have much effect.
I am currently using
body.setRestitution(0.8); body.setFriction(1); body.setDamping(0.2,0.1);
Problems
At high linear damping values, the ball seems to slow down too quickly.
At lower values, it seems to take age to finally stop.
When the ball is in the air, it seems unreasonable to apply linear damping at all.
Analysis
I think the problem may be linear damping in ammo.js, which leads to exponential slowdown.
I tried:
- Golf video recording
- Measuring the location of the ball in each frame
- Determining the location and speed of the ball against time
The results are shown below. It seems to me that the velocity profile is much closer to linear than exponential.
Any suggestions on an algorithm to get ammo.js more realistic?

source share