Isometric WASD Movement using Rigidbodies

I’m trying not to use the Unity CharacterController, and opt for a more flexible system with Rigidbodies.

I’m trying to implement a WASD movement, but how can I match the orientation of the character to the angled Main Camera. I researched a bit and notice someone with the same issue, but the commentors used the CharacterController [in this thread][1].

here’s my initial attempt (obviously incorrect):

 float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

       Vector3 forward = Camera.main.transform.forward;
       Vector3 right = Camera.main.transform.right;
       forward.y = 0;
       right.y = 0;

       Debug.Log("Forward: " + forward + " Right: " + right);

       Vector3 moveDirection = (forward * moveHorizontal) + (right * moveVertical);
       transform.forward = moveDirection;

       Debug.Log("Facing= " + moveDirection);

        rigidbody.velocity = moveDirection * speed;

but I’m not sure how to use those vectors. Any help is appreciated!

Just make the camera a child of the player object. It will translate/rotate with it perfectly.

void FixedUpdate()
var moveDirection = new Vector3(Input.GetAxisRaw(“Horizontal”), 0, Input.GetAxisRaw(“Vertical”));
moveDirection = Camera.main.transform.TransformDirection(moveDirection);
moveDirection.y = 0;

       rigidbody.MovePosition(rigidbody.position + moveDirection * speed * Time.deltaTime);