Please help me set up my inputs. Im pretty confused.

    if (Input.GetAxis("Vertical"))

{
        transform.position += transform.forward * moveSpeed * Time.deltaTime;

}

    if (Input.GetAxis("Vertical"))

{
        transform.position += -transform.forward * moveSpeed * Time.deltaTime;

}

    if (Input.GetAxis("Horizontal"))
{
        transform.eulerAngles.y += - turnSpeed * Time.deltaTime;

}

    if (Input.GetButton("Horizontal"))
{
        transform.eulerAngles.y += turnSpeed * Time.deltaTime;

}
}

How do i define which are positive and which are negative? - Do i have to set up two inputs per axis, i know this is probably a silly question (i apoagies.) but im really struggling to find an appropriate solution.

Also, is there an easy way of setting it up detect the amount of force on the stick?

I would really appreciate your help - as always.

Thanks,

  • Graeme.

You don't actually need two seperate ones. Just use one for each! Horizontal means both left and right, with one (I think left, but check this) being negative and the other positive. Same with Vertical --- it accounts for both. So just lose some of the excess statements, and it'll be fine.

I am not a 100% sure on what you are trying to achive but anyways:

function Update ()
{
var horizontalSpeed = Input.GetAxis("Horizontal");

var verticalSpeed = Input.GetAxis("Vertical");

transform.position += transform.forward * verticalSpeed * Time.deltaTime;

transform.positon += transform.right * horizontalSpeed * Time.deltaTime;
}

You only need to use 1 axis at the time. Since Input.GetAxis returns form -1 to 1 and therefor it is unneccersary to use this twice:

if (Input.GetAxis("Vertical"))
{      
transform.position += transform.forward * moveSpeed * Time.deltaTime;
}   
if (Input.GetAxis("Vertical"))
{      
transform.position += -transform.forward * moveSpeed * Time.deltaTime;
}

but simply use:

   var verticalSpeed = Input.GetAxis("Vertical");

   transform.position += transform.forward * verticalSpeed * Time.deltaTime;