- Home /
How do I stop all momentum of an object?
As a follow up to this question is it possible to arrest movement of an object?
In my game where the player is a ball rolling around a surface. When the ball rolls off the table (I have a plane set up with a trigger to respawn the ball), it respawns in the right location, but it keeps all momentum from before it hit the trigger.
I have tried to set the velocity of the object to 0, but it doesn't cause the object to remain stationary until the next user input.
What can I add to my script to respawn the ball without any momentum?
but it doesn't seem to have the desired effect
Please elaborate
Have you tried setting "is$$anonymous$$inematic = true" rather than adjusting the Velocity of the ball ?
What is exactly the movement it still has? Does it still have an angular velocity? If so, try setting that to zero as well.
Answer by Baste · Dec 11, 2014 at 11:16 AM
If this doesn't work:
transform.position = respawnPosition;
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
You're adding velocity to the ball after you have moved it.
What is the difference between rigidbody.velocity and rigidbody.angularVelocity?
It's basically the rate at which an object is rotating around its axis of rotation. As the name says, it's angular. This in contrast to normal velocity. So say you hit a ball with topspin. Then it both has a velocity (how it moves) and angular velocity (how it spins).
It's like one of those toy cars where you yank something to rev the wheels, them put it down. You ball is like plucking up one of those moving cars and dropping it at the start of the track, with the wheels still spinning.
That definition helps immensely. That means this is likely the solution to my problem, as the ball is both moving and spinning (rolling) as it falls off the "table." I will confirm at my next opportunity.
I'd upvote you, but I don't have enough rep. Thanks for the help.
Your answer
Follow this Question
Related Questions
If trigger hit, spawn it 1 Answer
Best way to achieve Sonic style physics? 0 Answers
Soccer Ball Kick Help 2 Answers
Constant force, with gravity, and correct collisions. 2 Answers