I’m making a space exploration game, it currently has 0 gravity applied to the entire scene. What I’m trying to get it to do is move in the direction it is facing, so all WASD does is control rotation. But with this current script the rotation works fine, but with a space click it moves up. Up and only up. Hope you can help, thanks.
var speed = 0.8;
var turnSpeed = 0.15;
function Start () {
rigidbody.useGravity = false;
}
function Update () {
if (Input.GetButton("Jump")) { //Spacebar by default will make it move forward
rigidbody.AddRelativeForce (Vector3.forward*speed);
}
rigidbody.AddRelativeTorque ((Input.GetAxis("Vertical"))*turnSpeed,0,0);
// W key or the up arrow to turn upwards, S or the down arrow to turn downwards.
rigidbody.AddRelativeTorque (0,(Input.GetAxis("Horizontal"))*turnSpeed,0);
// A or left arrow to turn left, D or right arrow to turn right.
}