Hi,
I’m creating a basic spaceship style movement system and and am moving the object using AddForce applied to its Rigidbody when a ‘thrust’ key is held down. The direction of the force is based on the forward direction of its camera, in First Person which is controlled by the mouse (i.e. it moves in the direction it is looking). The force is only applied when the thrust key is pressed down, which means that if the mouse is moved around after the key is released, the ship will continue to move in the direction in which the force was applied, not where it is currently looking.
In basic terms:
shipRB.AddForce(cameraTrans.forward * ThrustSpeed);
I was wondering how I might be able to change the direction of the Rigidbody and have it turn/rotate and continue to move in the direction the camera is looking in, even when the key has been released.
Any help would be great - thanks in advance.