Contact point in Impostor.applyForce() is handled differently with ammo and cannon plugin

Documentation says (at least for impulses, but I expect it to be the same for forces):

Applying an impulse requires a vector giving the magnitude and direction of the impulse and the position vector of the contact point of the impulse. The contact point of the impulse is given in world coordinates.

This seems to be true for CannonJSPlugin, whereas AmmoJSPlugin wants it in body coordinates.


Pinging @Cedric

Hi @Joerg_Plewe

The conversion is present in the code :

And I changed your PG to try it:

In my case, I apply a force at the box position. With cannon or ammojs, they both go upward. If the force position was only local with ammojs, the cube would spin.

Thx for the quick answer. In your PG of course nothing rotates for the force directly hits CG.

But when you push boxCollider a small step aside (x = 2) the contact point. so that torque is actually created, cannon and ammo behave very differently. Ammo results in an ondulating, swinging turn because the contact point wanders from side to side due to rotation, whereas cannon creates the (expected and correct?) constant increase in angular velocity.

In any case, only one behaviour should be the correct one and the other is a bug?

I’ll change it to using applyImpuls() and see what Oimo delivers.

1 Like

Did it. Omio behaves as Cannon.

Somehow … does Omio handle the inertia tensor differently (spins much faster) … is this worth another bug?

ok, I see it now. oimo/cannon behave correctly. There is an issue with ammo. I debugging now to see why it’s wrong.

1 Like

PR is live