- Home /
Slow vehicle to stop
What should I do to add a static stop to a spaceship controller script I've been working on? I am not asking for somebody to make the function. I am just asking what would need to be included and how would I do it. Increase rigidbody drag on button up? Apply a force in the opposite direction? As it is when any movement key is let go of the ship immediately snaps to a stop. I'd like it to slow down and stop not immediately but quickly. I'd like to hear your input, as I am not sure how this should be done.
Answer by tanoshimi · Sep 12, 2013 at 10:25 AM
This sounds like it might be more suited to a forum discussion rather than Unity Answers - there's no correct "answer", since you're not really asking a question. What's more - knowing the most appropriate way to slow down a vehicle probably requires knowledge of what made it move in the first place ;)
If you're trying to create a physics simulation, then you need to consider forces of drag, gravity, friction etc. and use these to act upon a rigidbody component. Since you're talking about spaceships, drag is not really relevant - you'll need to apply some sort of reverse thrust to counteract any forward motion.
If you're creating a shoot-em-up and want to add a little bit of "momentum" to the movement of the spaceship so it doesn't come to an abrupt halt, you could simply decrease the speed in a loop - something like `if(!movementkeyspressed) {spaceshipspeed *= 0.7;}
I'd recommend you simply try different approaches until you get something that "feels" right for your game.
Your answer
![](https://koobas.hobune.stream/wayback/20220613114016im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
My movement keys are opposite to actual movement? 8 Answers
[CLOSED] Can't Move Left Or Right (a/d) In This Movement Script? [CLOSED] 0 Answers
Unity Error Cannot Implicity Convert type 'float' to 'bool' 1 Answer
Mobile camera smooth 0 Answers
Limiting the rotation based on the angle of the player mesh 0 Answers