Why does resetTimer act counter-intuitively?

In the following code, when you press the WASD keys the object rotates in that direction. On releasing the keys the object should rotate back to its initial rotation, (which is 0,0,0).

This works, but the resetTimer variable should control the time taken to rotate back to the start position. However, the lower the value of resetTimer, the longer it takes. This seems counter-intuitive. Surely the higher the value, the longer it would take. Can anyone explain why this is the case?

The code of interest is at the bottom, I’ve included the whole lot so people can see what I’m trying to do.

var rotSpeed			:	float = 100.0;
var durationPressed 	:	float = 0.0;
var resetTimer			:	float = 6;
var keyPressed			:	boolean = false;
var startRot 			: Quaternion;
//var timeVar				:   float = Time.deltaTime * resetTimer;


function Start () 
{
startRot =  transform.rotation;
}

function Update () 
{

// w key down
if (Input.GetKey ("w"))
	{
	transform.Rotate(rotSpeed * Time.deltaTime, 0, 0 );
	durationPressed += Time.deltaTime;
	keyPressed = true;
	}
	
// w key up
if (Input.GetKeyUp ("w"))
	{
	durationPressed = 0;
	keyPressed = false;
	}

// a key down
if (Input.GetKey ("a"))
	{
	transform.Rotate(0,0, rotSpeed * Time.deltaTime );
	durationPressed += Time.deltaTime;
	keyPressed = true;
	}
	
// a key up
if (Input.GetKeyUp ("a"))
	{
	durationPressed = 0;
	keyPressed = false;
	}
	
// s key down
if (Input.GetKey ("s"))
	{
	transform.Rotate(-rotSpeed * Time.deltaTime, 0, 0 );
	durationPressed += Time.deltaTime;
	keyPressed = true;
	}
	
// s key up
if (Input.GetKeyUp ("s"))
	{
	durationPressed = 0;
	keyPressed = false;
	}

// d key down
if (Input.GetKey ("d"))
	{
	transform.Rotate(0,0, -rotSpeed * Time.deltaTime );
	durationPressed += Time.deltaTime;
	keyPressed = true;
	}
	
// d key up
if (Input.GetKeyUp ("d"))
	{
	durationPressed = 0;
	keyPressed = false;
	}

if (!keyPressed)
	{
	transform.rotation = Quaternion.Slerp(transform.rotation, startRot, Time.deltaTime * resetTimer);
	}

}

The last parameter of Quaternion.Slerp is a value between 0 and 1 that’s used as a multiplier for the current rotation. When it’s 0 it means it’s at the transform.rotation, when it’s 1 it means it’s reached startRot. 0.5 means it’s right in the middle of those two rotations.

I recommend adding a new variable that you add the deltaTime to and then you can use that to divide it by resetTimer to get a value between 0 and 1. Also instead of using transform.rotation as the first parameter of Quaternion.Slerp, you should save the transform.rotation of when the keyPressed is set to false, now it’s updated every frame to be the current rotation when it should be the original rotation.

@Benproductions1

As I said in my above post, “I appreciate the pseudo-code above wont work, it’s just illustrative of the kind of effect I’m trying to achieve.” I presume you could infer what I was trying to achieve?

I merely highlighted that what I’d consider a relatively straightforward concept (On condition, change the rotation over time until it equals x), isn’t actually as straightforward as I thought.

You seem a bit abrasive. It’s clear to anyone reading that my question is basic, and that I’m trying to learn the syntax and concepts of a new language.

Rather than questioning my ability to understand, perhaps you could have suggested an alternative method to achieve the same goal, or explained how “calling” invalidates my example.

Anyway, thanks for taking the time to reply.