1

I'm trying to make tank movement like in Wii Tanks. I can't figure out how to rotate the tank in the direction of movement. The rotation would only be on the y-axis so the tank doesn't start flipping out.

    moveDir = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    moveDir = transform.TransformDirection(moveDir);
    controller.Move(moveDir * Time.deltaTime * speed);

This is my code for moving the tank so now I just need it to rotate. Thanks for taking the time to read my question.

0 Answers0