Hello!
Having an annoying issue when moving my player around a scene. When facing right the up and down buttons work as they should, but when I face left the up and down buttons are inverted.
void movement ()
{
position = transform.TransformDirection(Vector3.right)*speed;
if(Input.GetKey(KeyCode.LeftArrow))
{
transform.eulerAngles = new Vector3(0,180);
FacingRight= false;
{
controller.Move(position * Time.deltaTime);
}
}
if (Input.GetKey (KeyCode.RightArrow))
{
transform.eulerAngles = new Vector3 (0,0);
FacingRight = true;
{
controller.Move (position * Time.deltaTime);
}
}
if (Input.GetKey (KeyCode.DownArrow))
{
controller.Move(-transform.forward * speed * Time.deltaTime);
}
if (Input.GetKey (KeyCode.UpArrow))
{
controller.Move(transform.forward * speed * Time.deltaTime);
}
}
I tried using transform.Translate instead of controller.Move for the up and down arrows. While it did move correctly, It caused the player to move through objects/ colliders didn’t interact with the object.
Any help would be greatly appreciated