7

Background

I am playing with making a minigolf game using three.js and the ammo.js conversion of the Bullet Physics library but I am having some trouble getting the ball to move realistically.

(I've put a demo at penguinspuzzle.appspot.com/minigolf.html if you want to have a look at how this works in practice.)

Question

What is a good algorithm to give more realistic motion of a minigolf ball?

What I've tried

In ammo.js there are options for friction, linear damping, and rotational damping.

As the ball rolls, the friction setting does not seem to have much effect.

I'm currently using

body.setRestitution(0.8);
body.setFriction(1);
body.setDamping(0.2,0.1); // linear damping, rotational damping

Problems

With high values of linear damping the ball seems to decelerate too fast.

With lower values it seems to take ages to finally stop.

When the ball is in the air it seems unreasonable to be applying linear damping at all.

Analysis

I think the problem may be the linear damping in ammo.js which causes an exponential slow down.

I tried:

  1. Recording a video of a golf stroke
  2. Measuring the location of the ball in each frame
  3. Plotting the location and speed of the ball against time

The results are shown below. It looks to me like the velocity profile is much closer to being linear than exponential.

Any suggestions for an algorithm to get ammo.js to be more realistic?

Golf analysis

4

1 回答 1

2

我发现您正在对球形物体使用“常规”摩擦。在物理学中有一个单独的概念,即圆形物体的“滚动摩擦”。我不知道 Bullet Physics 是否在其 API 中提供了这样的概念。如果是这样,请尝试用滚动摩擦对应物替换它:

body.setFriction(1);
于 2013-08-29T18:55:19.887 回答