// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { // toggle the engine if (rocketEngine.engineOn) { rocketEngine.SetEngine(false); ge.BodyOnRails(shipNbody, centerNbody); } else { rocketEngine.SetEngine(true); Vector3d vel = ge.GetVelocityDoubleV3(shipNbody); rocketEngine.SetThrustAxis(vel.ToVector3().normalized); ge.BodyOffRails(shipNbody, ge.GetPositionDoubleV3(shipNbody), vel); } } }