if the camera’s Y rotation = 0 then i want my player to move in the +Z direction, so how do i do this
its a 3-D game, I’m using Rigid Body to move my player, transform to rotate my camera.
i can change the movement / rotation if needed to Rigid Body or Transform.
by the way i’m using c#.
Try something like this:
public float speed = 5;
camera = GameObject.FindGameObjectWithTag("MainCamera").transform;
Vector3 forward = camera.forward;
transform.forward = forward;
GetComponent<Rigidbody>().Addforce(forward * speed);
This code is intended to be attached to the player game object.