Skip to main content
2 of 2
fixed typos, added markdown to code & keypresses, left aligned code
Pikalek
  • 12.5k
  • 5
  • 45
  • 52

ForceMode2D.Impulse not appliying force to the sides

I've spent hours trying to find the problem with this:

if (Input.GetKeyDown(KeyCode.Q))
{
    playerController.rb.AddForce(new Vector2(-forceAmount, 0), ForceMode2D.Impulse);
}
if (Input.GetKeyDown(KeyCode.E))
{
    playerController.rb.AddForce(new Vector2(0, forceAmount), ForceMode2D.Impulse);
}

When I press E force is applied upwards normally, but when I press Q nothing happens.

I checked the rigidbody and the physics material, and the issue doesn't come from those because I changed the Mass and the Gravity Scale of the player, changed the friction of the PhysicsMaterial2D to 0 and non 0, and applied force while the player is in the air, but none of them worked.