Limiting/smoothing rotation speeds

Hi - I’m currently working on a little project that allows the user to control a spaceship. The spaceship speeds along its axis, and it turns like a fighter jet (i.e., you need to bank turns, etc.)

I’ve currently got a tiny script that accomplishes this through mouse movement, and two keys.

var maxSpeed = 20;
var speed = 0;
function Start () {


function FixedUpdate () { 
	transform.Translate(Vector3.back * speed * Time.deltaTime) ; 

	if (Input.GetKey('x')){      //speed up
		if (speed < 50){
			speed = speed + 1;
	if (Input.GetKey('z')){      //slow down
		if (speed > 10){
			speed = speed - 1;
	transform.Rotate(Vector3( -Input.GetAxis("Mouse Y"), 0, 0) * Time.deltaTime * 100);
	transform.Rotate(Vector3( 0, 0, Input.GetAxis("Mouse X")) * Time.deltaTime * 100);

All of this works quite well, actually! However, there is a problem - the ship will turn as quickly and as suddenly as the user moves the mouse. How can I set up the controls so it feels like the spaceship has some weight? Can I slowly ease into a turn, and limit the speed that the ship will turn at? (sort of like the airships in Planetside 2, if you’ve ever played that - this is the desired effect)

so basically

  • the player can only turn at a limited speed, not the speed of their mouse
  • the rotation will be smoothed, instead of happening instantaneously

I have a feeling this has something to do with lerp - I’m still fairly new to the API, and I’m doing a lot of homework. However, easing is something that I still can’t really grasp.

Yup you are absolutely right ,you will need Lerp, Quaternion.Lerp or Quaternion.Slerp

You can refer to this link