- Home /
How to make my air plane to fly straight up (its local y-axis is parallel with global y-axis)?
I am making an air plane game and able to fly my airplane around fine. However, to make the game more playable, I wanted my plane to have the following behaviors:
When the user hit the up arrow, the plane will move upward (assuming the plane is right side up) or downward (if the plan is currently) upside down.
Similarly, when the user hit the down arrow, the plane will move downward (assuming the plane is right side up) or upward (if the plan is currently) upside down.
When the user does not press up or down arrow, I'd like my plane to fly horizontally (i.e, its local y-axis is parallel to the global y-axis).
Let's take an example: initially, my plane is perfectly horizontal (its rotation around its local x-axis is 0 degree). Then the user presses the up arrow. My plane will rotate around its x-axis 2 degree (at this point, it's climbing). Now, the user release the up arrow. In the next frame (when Update is called), I want to rotate my plane -2 degree so that it's flying horizontally.
Would some one show me how to accomplish requirement #3 above?
Your answer
Follow this Question
Related Questions
Streaming and displaying score with photon? 0 Answers
Application.LoadLevel problem. 1 Answer
Can you trick a Ui Button that it is being clicked with code? 3 Answers
difference between Gameobject.findobjectoftype<...>(); and simple findobjectoftype<...>(); ? 2 Answers
Axis disabled? (IO have not changed default input except fire1 and fire2) ? 0 Answers