Hi im making a game with a ball like in breakout and i want a button to freeze the ball for a short amount of time.
How do i memorize the velocity of the ball, so that he can move along the last velocity vectors?
And what would be the best way to disable the script for a shoort duration?
You can get the current velocity of Rigidbody with Rigidbody.velocity. Store it in a Vector3. Set it To (0,0,0) for the moment. When pause is over write the stored values again to Rigidbody velocity.
// at beginning of script
private Vector3 vel;
// Pause button pressed
vel = myRigidbody.velocity;
myRigidbody.velocity = Vector3.zero;
// Pause everything else, do stuff.
//Unpause
myRigidbody.velocity = vel;