Hi! So I have a constant force that is pushing my player upwards for my game but I also have a script that whenever you move left or right it sets the velocity to something pretty low so you don’t infinitely move to the left or right. But whenever I move left or right it sets the velocity lower which also completely stops my constant force so it take like 5 seconds to reach max speed again which really messes things up for me. I know this may sound confusing but I’d really enjoy some help.
As mentionned by bobisgod, you need to keep the current vertical velocity, and set only the horizontal velocity. Assuming your vertical velocity is on y axis, and horizontal on the x axis :
Vector3 velocity = new Vector3(horSpeed *Input.GetAxis(“horizontal”), transform.velocity.y, transform.velocity.z)
this should slove your problem.