however, when its moving up is not up anymore, its up plus/minus the y rotation
here is the code
if (joystick.Horizontal != 0 || joystick.Vertical != 0)
{
transform.Translate(transform.forward * Time.deltaTime * speed * joystick.Vertical);
transform.Translate(transform.right * Time.deltaTime * speed * joystick.Horizontal);
transform.LookAt(transform.localPosition + new Vector3(joystick.Horizontal, 0, joystick.Vertical));
}
else
{
_rb.velocity = Vector3.zero;
}
The player is moving in circles. How do I fix this so it looks normal instead? (I understand why it doesnt work but i have no idea how to fix it!)
LOOK AT THIS BECAUSE I HAVE NO IDEA HOW TO EXPLAIN IT
Here is an example
If i turn an object 90° for example and want it to move to the right a little, it wont move to the right when i press [D]. It will apparently move downwards, even if its moving to the right
Also, here is the old controls that worked (now commented)
if (Input.GetKey(KeyCode.W))
{
transform.Translate(Vector3.forward * Time.deltaTime * speed);
}
if (Input.GetKey(KeyCode.S))
{
transform.Translate(Vector3.back * Time.deltaTime * speed);
}
if (Input.GetKey(KeyCode.A))
{
transform.Translate(Vector3.left * Time.deltaTime * speed);
}
if (Input.GetKey(KeyCode.D))
{
transform.Translate(Vector3.right * Time.deltaTime * speed);
}
//[...]
transform.LookAt(target);
^^^in void Update()