I hope someone can help me out. I am struggling with a little game which i cannot get the tilt function working. The game is for android and i want to use the tilt sensor in the phone to tilt an object on it's pivot point.
This is what i have so far...
public class TiltAround : MonoBehaviour
private Quaternion localRotation;
public float speed = 1.0f;
void Start ()
localRotation = transform.rotation;
float curSpeed = Time.deltaTime * speed;
localRotation.y += Input.acceleration.x * curSpeed;
localRotation.x += Input.acceleration.y * curSpeed;
transform.rotation = localRotation;
But the object is moving anywhere but not staying at one point (the pivot) and tilting the ojbect itself. I hope someone can point me in the right direction..
Mar 22 '12 at 08:21 PM