- Home /
Airplane flying using accelerometer
Hi,
I have been trying so hard to move an airplane using accelerometer on Android. I am able to do the right and left tilted movement of airplane using accelerometer by using the code from the following link
http://forum.unity3d.com/threads/43984-Unity-testproject-a-little-flightsim
but I am stuck at moving the plane up and down using the same code and logic. I have been assigned a project to flying an airplane based on accelerometer. I have to control the left-right and up-down tilt using accelerometer. Can anyone here provide me a sample code or reference document to accomplish the same. I am trying to replicate the movement of airplane as in exionfly 3d game (https://play.google.com/store/apps/details?id=opengl_es.exionfly&hl=en). So far only able to move the plane left-right tilted.
At http://unity3d.com/support/resources/example-projects/iphone-examples
There is a cool example called Star Troopers that gives a project file doing exactly what you're asking for. Look in the player controls script I believe it is, under the fixedUpdate function.
The example doesn't solve the problem of holding the phone at a (naturally) tilted pitched angle when the game starts. Does anyone have a solution to that? I have done a lot of searching.
I tried saving the start Input.acceleration and then $$anonymous$$us that initial vector to new vector, but its not working as expected.
Your answer
Follow this Question
Related Questions
Aircraft controller script 2 Answers
Angular Velocity is causing object to spin out of control 0 Answers
Physics collider behaving very odd on iphone 0 Answers
Rigidbody2D with Accelerometer 0 Answers
Preventing rotation of rigidbody at a specific rotation 0 Answers