The basic problem is that pressing forward, the player object moves forward until I rotate and then it starts moving in a different direction relative to the camera...
After I started typing this I realized that the character was rotating, but the camera wasn't keeping to the back of the character.
But that comes with a new problem... I don't know how to rotate the camera the way I want to. It has to rotate around an offset center based on the character.
Can someone tell me what how to do that so that it corrects this problem?
Here's the movement script, input is handled in another
And followed by what I currently have for the camera.
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
float WalkSpeed = 3.0f;
float RunSpeed = 6.0f;
float TurnSpeed = 3.0f;
void Update() {
CharacterController Move = GetComponent<CharacterController>();
GetInput controller = gameObject.GetComponent<GetInput>();
//transform.Rotate(0, controller.Turn * TurnSpeed, 0);
Vector3 move = new Vector3(controller.Strafe, 0, controller.Forward);
float Speed = WalkSpeed;
Move.SimpleMove(move * Speed);
}
}
using UnityEngine;
using System.Collections;
public class CameraMovement : MonoBehaviour {
float TurnSpeed = 3.0f;
// Update is called once per frame
void Update () {
GetInput controller = GameObject.Find("Player").GetComponent<GetInput>();
transform.Rotate(0, controller.Turn * TurnSpeed, 0);
}
}