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

**URL:** <https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422>\
**Category:** Bugs\
**Created:** [March 24, 2020, 1:35pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422 "2020-03-24T13:35:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joerg\_Plewe](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joerg_plewe/32/7426_2.png) [@Joerg\_Plewe](https://forum.babylonjs.com/u/Joerg_Plewe)\
**Post date:** [March 24, 2020, 1:35pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422/1 "2020-03-24T13:35:07Z")

</div>

[Documentation](https://doc.babylonjs.com/how_to/forces#impulses) 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.

Playground: [https://playground.babylonjs.com/#FD65RR#28](https://playground.babylonjs.com/#FD65RR#28)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 24, 2020, 3:01pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422/2 "2020-03-24T15:01:04Z")

</div>

Pinging @Cedric

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [March 24, 2020, 3:30pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422/3 "2020-03-24T15:30:49Z")

</div>

Hi @Joerg_Plewe

The conversion is present in the code :

> <https://github.com/BabylonJS/Babylon.js/blob/master/src/Physics/Plugins/ammoJSPlugin.ts#L375>

And I changed your PG to try it:  
[https://playground.babylonjs.com/#FD65RR#29](https://playground.babylonjs.com/#FD65RR#29)

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.

---

<div class="post-metadata">

**Author:** ![Joerg\_Plewe](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joerg_plewe/32/7426_2.png) [@Joerg\_Plewe](https://forum.babylonjs.com/u/Joerg_Plewe)\
**Post date:** [March 24, 2020, 5:01pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422/4 "2020-03-24T17:01:37Z")

</div>

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.

[https://playground.babylonjs.com/#FD65RR#30](https://playground.babylonjs.com/#FD65RR#30)

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.

---

<div class="post-metadata">

**Author:** ![Joerg\_Plewe](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joerg_plewe/32/7426_2.png) [@Joerg\_Plewe](https://forum.babylonjs.com/u/Joerg_Plewe)\
**Post date:** [March 24, 2020, 5:10pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422/5 "2020-03-24T17:10:35Z")

</div>

Did it. Omio behaves as Cannon.

[https://playground.babylonjs.com/#FD65RR#31](https://playground.babylonjs.com/#FD65RR#31)

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

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [March 24, 2020, 6:10pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422/6 "2020-03-24T18:10:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [March 25, 2020, 1:59pm UTC](https://forum.babylonjs.com/t/contact-point-in-impostor-applyforce-is-handled-differently-with-ammo-and-cannon-plugin/9422/7 "2020-03-25T13:59:45Z")

</div>

PR is live

> <https://github.com/BabylonJS/Babylon.js/pull/7906>
