Hey guys,
I was wondering whats the best way to get which way the character is moving for example is it moving back or forward or strafing left or right.
I tried using
if(MoveVector.x <1)
But the problem with that is the player rotates and faces where the camera is facing and that will make it not valid.
This is how im moving my player at the moment.
void GetLocomotionInput()
{
var deadZone = 0.1f;
TP_Motor.Instance.VerticalVelocity = TP_Motor.Instance.MoveVector.y;
TP_Motor.Instance.MoveVector = Vector3.zero;
if (Input.GetAxis("Vertical") > deadZone || Input.GetAxis("Vertical")< -deadZone)
{
TP_Motor.Instance.MoveVector += new Vector3(0, 0, Input.GetAxis("Vertical"));
}
if (Input.GetAxis("Horizontal") > deadZone || Input.GetAxis("Horizontal")< -deadZone)
{
TP_Motor.Instance.MoveVector += new Vector3(Input.GetAxis("Horizontal"), 0, 0);
}
}
Thanks in Advance.