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 EE force is applied upwards normally, but when I press QQ nothing happens.
I checked the rigidbodyrigidbody
and the physics material, and the issue doesn't come from those because I changed the MassMass
and the Gravity ScaleGravity Scale
of the player, changed the friction of the PhysicsMaterial2DPhysicsMaterial2D
to 0 and non 0, and applyedapplied force while the player is in the air, but nonnone of them worked.