3rd person character movement relative to camera

I’m trying to build a simple 3rd person controller with a mouse-orbit camera where the character will move relative to the direction the camera is facing, so for example if you hit “left” he’ll move to the camera’s left, “forward” away from the camera, etc. I’m borrowing the camera script from here, seems to work fine: http://wiki.unity3d.com/index.php?title=MouseOrbitImproved.

Right now he’ll MOVE in a direction relative to the camera, but I just can’t figure out how to make him POINT in the direction that he’s moving. He’ll only face the “global” forward/back/left/right. I feel like the answer is right there, I just can’t wrap my head around the math. I’m new at coding so it’s all a bit foreign to me especially Quaternions and Euler angles etc. Any help would be appreciated! Here’s my full character-movement script:

using UnityEngine;
using System.Collections;

public class CharMovement : MonoBehaviour 
{
	public float speed = 2f;
	public float runSpeed = 5f;
	public float turnSmoothing = 15f;
	
	private Vector3 movement;
	private Rigidbody playerRigidBody;
	
	void Awake()
	{
		playerRigidBody = GetComponent<Rigidbody> ();
	}
	
	void FixedUpdate()
	{
		float lh = Input.GetAxisRaw ("Horizontal");
		float lv = Input.GetAxisRaw ("Vertical");
		
		Move (lh, lv);
	}
	
	
	void Move (float lh, float lv)
	{
		movement.Set (lh, 0f, lv);
		movement = Camera.main.transform.TransformDirection(movement);
		
		
		if (Input.GetKey (KeyCode.LeftShift))
		{
			movement = movement.normalized * runSpeed * Time.deltaTime;
		} 
		else 
		{
			movement = movement.normalized * speed * Time.deltaTime;
		}
		
		playerRigidBody.MovePosition (transform.position + movement);
		
		
		if (lh != 0f || lv != 0f) 
		{
			Rotating(lh, lv);
		}
	}
	
	
	void Rotating (float lh, float lv)
	{
		Vector3 targetDirection = new Vector3 (lh, 0f, lv);
		
		Quaternion targetRotation = Quaternion.LookRotation (targetDirection, Vector3.up);
		
		Quaternion newRotation = Quaternion.Lerp (GetComponent<Rigidbody> ().rotation, targetRotation, turnSmoothing * Time.deltaTime);
		
		GetComponent<Rigidbody>().MoveRotation(newRotation);
	}

}

What is happening is that your targetDirection vector has been defined in world space, and never transformed to the camera space as you correctly achieved with the movement vector.

My advice would be, seeing as you have already calculated the movement vector, which is the direction you wish to face, and stored it in a variable accessible to the whole class, simply use that:

Quaternion targetRotation = Quaternion.LookRotation (movement, Vector3.up);

How about using Mouse Axis?