android - Unity3d Gyroscope look around -


i'm new unity , trying build solar system exploration app through unity. have environment set up, , need ability around (via tilting , moving phone itself, android) smoothly. have ability around, if complete 180, seems invert physical orientation of phone visual movements in game, e.g. if have turn 180 degrees, if tilt phone down shifts vision in game right, results in visual shift left. here code have far:

#pragma strict  private var quatmult : quaternion; private var quatmap : quaternion;  function start () {     input.gyro.enabled = true; }  function update () {  #if unity_android     quatmap = input.gyro.attitude; #endif      transform.localrotation = quaternion.euler(90, 0, 0) * quatmap * quaternion(0,0,1,0) /*quatmult*/; } 

any appreciated. thanks.

this should you're looking for: https://gist.github.com/chanibal/baf46307c4fee3c699d5. drag camera , should work.

you might want remove reset on touch part (input.touchcount > 0 in update) , debug information (the ongui method).