Increasing friction or drag on a spinning object

Hi. I’m fairly new to Babylon, but I’m hoping someone here can help me with a problem I’m running into. I’m creating a game that involves spinning a object (sphere) on a plane. When I adjust friction on the sphere and plane, it doesn’t seem to effect the rate of decay of the spin. I’d like the spinning object to stop spinning much sooner than it currently does. Any ideas how to accomplish this? Here’s my playground:

Hello and welcome to the forum !!!

Let s add @Cedric to the conversation as he loves Physix.

Welcone @tiptop

That’s an interesting test. Let me check how I can decay the spin…

With AmmoJS you can specify the linear and angular damping.
The important call is

marble.physicsImpostor.physicsBody.setDamping(0, 0.8);

The second parameter is the angular damping. Change its value to modify the spinning decay.

1 Like

Omg, that worked like a charm. I can’t thank you enough @Cedric!

1 Like

This solution has introduced one problem. I had a mouse event in my scene where the user could reset spin by clicking and releasing (or tap/release). To accomplish this, I used physicsImposter.sleep() which doesn’t appear to work how that I’ve switched to Ammo. Updated playground here:

Then you can play with angular velocity

Setting a value of (0,0,0) will stop it and any value on the Y axis will make it spin.

1 Like

Perfect thanks! And thanks for the tip on setting the spin. Much cleaner than what I was trying to do with forces.

1 Like