- Home /
 
slow rotation over time?
Hi, I have a spaceship that flys around until it finds a target, trying to slow down the rate in witch it turns.. everything i have fun online tells me to use: transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime * TurnSpeeed);
however no mater turn speed is 0.1f, 1, or 1000, it dose not make it slower. transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime ); by its own is closer, but its still not turning slow enough, if their a more efficient way to slow this down?
 if (Newdirectionflighttimer < 1) {
                     randomDirection = new Vector3 (Random.value, Random.value, Random.value);
                     Newdirectionflighttimer = 12;
                 }
 
                 Quaternion rotationA = Quaternion.LookRotation(randomDirection);
             transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime );
 
                 Newdirectionflighttimer -= 1 * Time.deltaTime;
 
               transform.rotation = Quaternion.Slerp (transform.rotation, targetRotation, Time.deltaTime * speed);
 
                  Should work fine if it's in one of the Update methods.
i alreadyy said this method doesn't change the speed of the rotation and yes its all in update.
Answer by HarshadK · Jul 06, 2016 at 06:14 AM
You can actually lerp your speed variable that you use in Slerp.
Something like:
 float startSpeed;            // This should be greater than endSpeed in order for slow down.
 float endSpeed;
 
 void SlowDown()
 {
     Quaternion rotationA = Quaternion.LookRotation(randomDirection);
     float speed = Mathf.Lerp(startSpeed, endSpeed, Time.deltaTime);
     transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime * speed);
 }
 
              Your answer
 
             Follow this Question
Related Questions
Storing camera angles for a FPS -1 Answers
Tilt object x degrees, smoothly 0 Answers
What is affected by the W in Quaternion(x,y,z,w)? 3 Answers
Use Euler angles for Quaternion variable in the Inspector 1 Answer
Rotate Issue 0 Answers