- Home /
Stoping Velocity Breaks Script [Solved]
Hello people. I'm pretty new to C#, so I don't know much about it, but I was testing around and looking at forums on how to stop velocity. I figured it out.
rigidBody.velocity = Vector2.zero;
So this works fine. Ok let me explain this code. The function "Thrust" is used to move the ship forward. The function "UpThrusting" is used to move the ship up and down. This all works perfect without the code line above, but when I add the line to stop the ship, the ship movement breaks. The ship does move straight or up. It only moves if you're holding them down at the same time... Here is the full code. Any help would be nice, thank you!
Your answer
![](https://koobas.hobune.stream/wayback/20220612190028im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Space Shooter tutorial shot velocity issues 0 Answers
Variable isn't assigned, even though I have assigned it in the Start() method 2 Answers
When I try to save the velocity of a rigidbody and use it later it doesn't work? 1 Answer
Rigidbody.velocity giving weird result 0 Answers
calculate velocity of animated parent rigidbody from script inside child 2 Answers