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: https://www.babylonjs-playground.com/#JHIHXA#3
Hello and welcome to the forum !!!
Let s add @Cedric to the conversation as he loves Physix.
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
The second parameter is the angular damping. Change its value to modify the spinning decay.
Omg, that worked like a charm. I can’t thank you enough @Cedric!
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: https://www.babylonjs-playground.com/#JHIHXA#7
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.
Perfect thanks! And thanks for the tip on setting the spin. Much cleaner than what I was trying to do with forces.