How do I use impulses?

Hi,
I’m using the Physics 2.0 behavior and I can use easily the Forces.
However, whenever I try to use an impulse in a certain situation, the game freezes instantly.
I’m using the “Apply polar impulse” function and I’m feeding it all parameters.

The situation: one object fires a bullet.
I can use the Apply Polar Impulse functions successfully on the object, but if I try it on the bullet, the game freezes.
The bullet has the Physics 2.0 behavior activated, set to dynamic and forces work on it.

The code is very simple:

  • Create bullet
  • Apply Polar Impulse on bullet, Angle = 0, Length = 5, Application point (0,0)

If I remove “Apply Polar Impulse” the game works smoothly, just the bullet remains in place (as there’s no force applied to it).
This same “Apply Polar Impulse” command works on the object (the one which is ‘firing’ the bullet) without any freeze.

Do you know what could be causing this issue and how to fix it?

Thanks

Hi,
Maybe a conflict with another event? Or there is a typo somewhere.
Application point shouldn’t be 0 but I don’t think it should freeze the game.
Please make a screenshot of the related events and parameters (and physics settings of your object).

Hi,
I investigated a bit more.
Doesn’t seem to be a conflict or a typo.
It appears that the engine is just making extremely long calculations on that object in particular.
Possibly the ‘bullet’ is just too small (12x2 px) and the engine has an issue.
The impulse works on other larger objects.
I’d say it’s not an error on the coding, but some limitation of the physics engine with small / asymmetric objects.

Reproduce the issue in a new project and share it with us, we’ll investigate :male_detective: