1
\$\begingroup\$

I am trying to rotate game camera using my android device orientation.Like this Using accelerometer input of device this may be done. But I don't know how to do this. I tried lot of methods, but failed. Anybody please help.

I am using unity 5.3 with C#.

\$\endgroup\$
  • \$\begingroup\$ Thanks @smkplus, I already tried this, but its not working. public float speed = 10.0F; void Update() { Vector3 dir = Vector3.zero; dir.x = -Input.acceleration.y; dir.z = Input.acceleration.x; if (dir.sqrMagnitude > 1) dir.Normalize(); dir *= Time.deltaTime; transform.Rotate(dir * speed); } \$\endgroup\$ – Manoj Balaji M Jul 16 '16 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.