- Home /
2D UFO Tutorial - Stop the Ship
I did the tutorial, but, I was wondering what is the correct way to slow-down and eventually stop the ship from moving once you have released the buttons for movement.
Thanks a lot.
Answer by AmirSavand · Apr 30, 2018 at 04:58 PM
I don't know which tutorial or game you are talking about but I can help.
You need to check in your update function if the button is released then reduce the speed by Time.deltaTime. It depends on how you are increasing it. Do the same but with a negative value.
UPDATE:
Try increasing the drag property of the Rigidbody of the ship. It should slow down and stop the ship.
This is the link to the tutorial: https://unity3d.com/learn/tutorials/s/2d-ufo-tutorial
It is official unit tutorial.
Let me know if you need any more info.
It just keeps on going.
Doesn't stop gradually or instantly.
It is not in the code.
But, it is a UNITY general Tutorial