With cannon-es even after weak explosion objects start to rotate as crazy. It may take many minutes for them to stop.
With regular cannon same explosion does almost nothing, you need to significantly increase the explosion strength to see the reaction. However, after that objects react normally, as expected.
What is the problem:
The need to change the explosion strength during transition cannon->cannon-es is normal, because different physics engines may be configured differently.
However, the extreme spin of objects affected looks like a serious malfunction.
I realize that the problem might be hidden inside of cannon-es itself. But it also might be connected with passing parameters from physicsHelper.applyRadialExplosionImpulse to cannon-es.
Since the cannon-es support now is declared in BabylonJS and I face the problem while using BabylonJS APIs, I decided to raise an issue here first.
What’s the difference between restitution/friction/rollingFriction in this case? I didn’t know that BabylonJS has also friction and rollingFriction parameters.
My guess that restitution determines which fraction of energy transfers from origin to receiver. While friction and rollingFriction dissipate velocity and angular velocity on each tick. Makes sense, but since I didn’t know that friction/rollingFriction exist I thought we can use only the restitution to determine how the object responds to forces applied.
Anyway, in this situation it feels more like post-fix or compensation for overwhelming amount of spin that the object receives. Thank you for workaround still, but it looks like that the main problem is that explosion itself gives non-realistic (broken) spin.
Mmm… in this case I actually think the behavior is correct. Bear with me a sec, imagine your floating in space; without friction or air-resistance there is nothing to stop you from spinning for an eternity. That is exactly what you see in the simulation.
So now maybe you’d argue that the spin of the box is too fast - try giving the box more mass. You will see that it now takes inversely more force to get it spinning faster again:
From what I can tell, the physics engine is just following standard Newtonian mechanics.
What’s the difference between restitution/friction/rollingFriction in this case?
I didn’t know that BabylonJS has also friction and rollingFriction parameters.
If the babylon.js docs say a given physics framework is supported then I generally think its safe to assume that it’s full API is exposed in some form or another.
We don’t support cannon-es just yet, only an imported cannon from the cannon npm package. We still need to finalize cannon-es support (and move away from the older cannon builds).
We currently don’t have it on our timeline, no. We can add that as an issue, but I doubt we will find time in the near future to finalize the implementation