Hi there, I'm extremely new to UnityIphone and I'm trying to do something that I would consider very simple.

I'm trying to make a object 'strafe' left and right depending on the tilt of the accelerometer, I don't even want velocity to come into play, simply move left at a constant speed in tilted left, and visa-versa.

Thanks - Caius

var speed : float = 10;
var moveThreshold : float = .2;

private var movex : float; 
private var iPx : float; 

function Update()
{
    movex = 0;
    iPx = iPhoneInput.acceleration.x;

    if (Mathf.Abs(iPx) > moveThreshold)
    {
        movex = Mathf.Sign(iPx) * speed;
        transform.Translate(movex,0,0);
    }
}

The variable `moveThreshold` is used so that your object will remain still when the device is upright and will only move when you lean the device enough.

`Mathf.Sign()` outputs a +1, 0 or -1, whereas `Mathf.Abs()` returns a positive number only.

http://unity3d.com/support/documentation/ScriptReference/Mathf.Sign.html http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html