Hello, I’m creating a game that uses Kinect to control flight, but I am having really big problems. The speed is constant, and the camera is attached to the head joint, so the idea is wherever the player turns the head, is where the player should turn and look at and continue moving forward. Right now instead of turning, the character it’s only changing the forward vector’s direction, and it’s making my character fly sideways or even backwards. Any ideas on how can I achieve that??? Here’s my code:
Vector3 newDirection = Vector3.zero;
newDirection = new Vector3(GameObject.Find("MainCamera").transform.forward.x, 0, GameObject.Find("MainCamera").transform.forward.z);
if (newDirection != Vector3.zero)
{
transform.rotation = Quaternion.LookRotation(newDirection);
transform.forward = newDirection;
}
transform.Translate(transform.forward * (movementSpeed / 2) * Time.deltaTime);
Any help is appreciated