Hello, i have a problem where when i try to set the velocity back to 0 after the game is unpaused, my player shoots across the screen super fast. All i need is for the player to remain in the same position after the game in unpaused. If i do not reset the velocity after the game in unpause, the player will just shoot to the ground because the gravity has built up over the time the game has been paused for some reason? Thanks
Part of My Code:
void Update(){
rigidbody.AddRelativeForce(Vector3.right * 10 - rigidbody.velocity);
if(Input.GetKeyDown("up") || (Input.GetMouseButtonDown(0)))
{
velocity = rigidbody.velocity;
velocity.y = jumpSpeed;
rigidbody.velocity = velocity;
}
if (pauseMenuScript.isPaused)
rigidbody.velocity = new Vector3(0,0,0);
//rigidbody.velocity = Vector3.zero;
//rigidbody.angularVelocity = Vector3.zero;