Hi,I have the following script for flying in the game. by this code i can only fly in a flat plane with using WASD keys, but i want my flight be relative to which way the camera is facing in 3d space.How to do it? thankful
var speed = 60.0;
var jumpSpeed = 80.0;
var gravity = 0.0;
private var moveDirection = Vector3.zero;
private var grounded : boolean = false;
function FixedUpdate()
{
// Calculate the move direction
moveDirection = new Vector3(Input.GetAxis("Horizontal"),0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
// Move the controller
var controller : CharacterController = GetComponent(CharacterController);
controller.Move(moveDirection * Time.deltaTime);
}