I am using the MouseOrbitImproved script for camera control and animator controller with the botcontrol script from the Mecanim tutorial. What I need to have is for the character to always move in the direction the camera is facing when applying movement controls or pressing a mouse button. Right now it continues to move in the direction it’s currently facing no matter what direction the camera is.
// Allow turning at anytime. Keep the character facing in the same direction as the Camera if the right mouse button is down or Horizontal is pressed.
if(Input.GetMouseButton(0) || Input.GetButton("Vertical")) {
transform.rotation = Quaternion.Euler(0,Camera.main.transform.eulerAngles.y,0);
} else {
transform.Rotate(0,Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime, 0);
}
Fixed it. Added this to my control script, Thanks for everyones help.