I’m completely stumped by this problem. AddForce does nothing to the X-axis…
I’m at my wits end with this problem. I haven’t found anything online that helps. I really really want to implement wall jumps and a Dash to my game. But with no way to alter my horizontal movement, I don’t think that’s possible.
This is everything in my controller that controls horizontal movement. It works just fine for moving
float h = Input.GetAxisRaw("Horizontal");
if (h * GetComponent<Rigidbody2D>().velocity.x < maxSpeed)
GetComponent<Rigidbody2D>().AddForce(Vector2.right * h * moveForce);
if (Mathf.Abs(GetComponent<Rigidbody2D>().velocity.x) > maxSpeed)
GetComponent<Rigidbody2D>().velocity = new Vector2(Mathf.Sign(GetComponent<Rigidbody2D>().velocity.x) * maxSpeed, GetComponent<Rigidbody2D>().velocity.y);
This example command below will affect my Y Axis if change to (0, 1) but does absolutely nothing to my X axis no matter how ridiculous the Force (like (999999999999, 0)).
if (Input.GetButtonDown("Dash"))
{
rb.AddForce(new Vector2(9999, 0), ForceMode2D.Impulse);
}