Ballance imitation demo -- using Three.js and Ammo.js

Link to the demo:

This demo uses Ammo.js as physics engine.

Demo source code:


Nice! :grin: That was a lot of fun.

Couple of points:

  1. the controls need a bit of fine tuning, it’s hard to make minor adjustments
  2. the ball often rolls in the wrong direction.

I’ve faced 2. before, it’s hard to get balls to roll correctly. Are you applying the rotations in world or local space?

1 Like

Thank you. Here is the code from Ammo.js

    var p = transformAux1.getOrigin();
    var q = transformAux1.getRotation();
    objThree.position.set(p.x(), p.y(), p.z());
    objThree.quaternion.set(q.x(), q.y(), q.z(), q.w());

I think it should be in world space.

1 Like

Nice game!

I think @looeee refers to the forces applied to the ball.


Good work! Reminds me of one of my all time favorite games: Snowball run! A penguin running on a snowball on difficult tracks high in the sky. :smiley: (And with the most annoying music.)