I'm trying to move my Character on the world's XYZ Axes, but how do I get them?
I'm trying to do this because my Player is sort of a Sphere and is rolling around, so its xyz directions are rotating.
I thought I can fix this if I make it move with the world's xyz.
Does someone know how to do this, or another way to fix this problem?
This is my current code to move my olayer object:
public float playerSpeed = 20;
public float verticalInput;
public float horizontalInput;
// Update is called once per frame
void Update()
{
verticalInput = Input.GetAxis("Vertical");
transform.Translate(Vector3.forward * Time.deltaTime * playerSpeed * verticalInput);
horizontalInput = Input.GetAxis("Horizontal");
transform.Translate(Vector3.right * Time.deltaTime * playerSpeed * horizontalInput);
}