void FixedUpdate() { if (ship.IsDead()) { shakeTimer = shakeTime; return; } Vector3 shake = Vector3.zero; if (shakeTimer <= shakeTime) { float rad = Random.Range(0.0f, 360.0f); float magnitude = (1.0f - shakeTimer / shakeTime) * shakeMagnitude; shake.x = magnitude * Mathf.Cos(rad); shake.y = magnitude * Mathf.Sin(rad); shake = ship.transform.rotation * shake; shakeTimer += Time.deltaTime; } transform.position = Vector3.SmoothDamp(transform.position, followPoint.position, ref velocity, thrustSmoothing) + shake; Vector3 shipRotation = motor.getCurrentRotation(); Quaternion target; if (motor.IsManeuvering()) { Vector3 targetUp = Quaternion.Euler(shipRotation.x, shipRotation.y, shipRotation.z * curRollDamping) * Vector3.up; Vector3 up = Vector3.SmoothDamp(transform.up, targetUp, ref upVelocity, 0.01f); target = Quaternion.LookRotation(lookAt.position - transform.position, up); } else { target = Quaternion.Euler(shipRotation.x / 3.0f, shipRotation.y, 0.0f); } transform.rotation = smoothDampQuat(transform.rotation, target, rotationalSmoothing); if (Mathf.Abs(camera.fieldOfView - fovTarget) > Util.Epsilon) { float vel = 0.0f; camera.fieldOfView = Mathf.SmoothDamp(camera.fieldOfView, fovTarget, ref vel, 0.1f); } }