We will create a null object and have that be our _startingposition gameobject. I’m also going to have my ship mesh lerp toward the main parent object to create a smooth moving gameobject. For my game, I’m going to have my ship snap to the starting position whenever the game begins.
We then give our player a quick test to verify the movement of our ship. To do this, we want to add a transform.translate, move it to the right, apply it to time.deltatime, and provide a speed variable to make adjustments.
Now let’s go ahead and map the user inputs to this player. We will use the input manager.
This will allow us to move the ship on a horizontal and vertical axis based on our input. I also want to adjust the rotation of my ship. Let’s have a little fun with this. I created a empty game object called _shiprotation and based on the float value of my horizontal input, the rotation of that null changes. Now I make my ship mesh rotate via lerp to the _shiprotation gameobject to achieve that smooth movement.
Now the ship flies smoothly and rotates as well!