Accelerometer gyroscop property

Hi, I’m beginner in Unity and now I work on an app which may reproduce gyro property. Like on a video below. This is my student work.

This app on video was made with XNA, I just took a clean device accelerometer output and work with it. And now in Unity I can’t do it.

here my MonoDevelop code on C# for an 3d object.

void Update ()
{transform.Rotate (0 , 0, Input.acceleration.x);}

This code rotate object constantly while I need keep it parallel the horizon, like a gyro.
Please can anyone help my to understand what unity did with accelerometer output.

P.S Sorry for my grammar and bad English level.

void Update ()
{transform.Rotate (0 , 0, Input.acceleration.x);}

This code tells object to rotate on every frame by given values.
You need to modify transform.rotation. However, this involves converting Vector3 to Quaternion. Look at methods of both for a solution :slight_smile:

BTW, I don’t think this is the right forum for basic learning questions, this is specific to technical issues with WSA and WP.

Sorry about wrong forum :wink: Thank you for your answer, I will try your advice.

Hi again. I tried a different transform rotation like transform.rotation = Input.gyro.attitude; Which must to keep object parallel to horizon (i thought), now I’m empty. Can anyone help me?