- Home /
Android Z Axis
Greetings; when developing an Android application with accelerometer functionality, we assume the device is held parallel to the ground, but I want it to be held outward from the player in landscape orientation, instead. Seeing as the game's camera rotation is supposed to depend on accelerometer data, how would I go about changing the coordinates so that the Z axis is running forward instead of downward as it does currently?
The camera rotation and everything works fine (Except for the fact that it's a little "twitchy" even when laying still; I'm assuming this is a sensitivity issue) if we assume the Z axis is down, but for the game I'm developing the camera needs to be held outward from the player. Here is my camera "look" script:
using UnityEngine;
using System.Collections;
public class CameraMoveScript : MonoBehaviour {
Quaternion originalRotation;
void Update ()
{
originalRotation.y = Input.acceleration.y;
originalRotation.x = Input.acceleration.x;
transform.rotation = originalRotation;
}
void Start ()
{
originalRotation = transform.rotation;
}
}
Your answer
Follow this Question
Related Questions
GameObject dosen't move 2 Answers
Gyroscope smooth transitions (minimizing jerk from tiny movements) 1 Answer
Tilting ball with acceleration in 2D for android 0 Answers
Android camera rotation problem 0 Answers
Rotating camera problem C# Android 2 Answers