- Home /
2D movement that allows 2 or more forces.,2D movement that allows to have 2 different forces.
I have this code to move my player in my 2D platformer game:
r2d.velocity = new Vector2(horMovement * Time.fixedDeltaTime, r2d.velocity.y);
I am running into a problem when I try to use any functions like addforce or other unity physics stuff, this code just sets the velocity back to the horMovment and candles other forces. I couldn't find a better way to move the character that works smoothly and avoids this problem. I am just curoise of better ways to move the character. Thanks.,I have this code to move my player in a 2D platformer game:
r2d.velocity = new Vector2(horMovement * Time.fixedDeltaTime, r2d.velocity.y);
The problem is that when using addforce or any other velocity-changing unity physics stuff this code resets the x velocity out within a frame. I have not been able to find other movement options that get rid of the problem and work smoothly. I am just curious what other ways might be better to move the player. Thanks.