- Home /
Lerp and Slerp returns identical value?
I ran Lerp and Slerp under the same condition and tried to observe the difference in returned values, but it seems like their output are exactly identical. Am I doing wrong in the way I test it, or is this the way it's supposed to be?
The code I ran was like:
void Update()
{
float a = 0;
int counter = 0;
while (a < 1)
{
Vector3 lerp = Vector3.Lerp(new Vector3(0, 0, 0), new Vector3(0, 0, 100), a);
Vector3 slerp = Vector3.Slerp(new Vector3(0, 0, 0), new Vector3(0, 0, 100), a);
print(counter++ + "," + lerp.z + "," + slerp.z); // lerp.z and slerp.z are same vals
a = a + 0.01f;
}
}
Comment
Best Answer
Answer by Jessespike · Aug 17, 2016 at 09:40 PM
Yea, this is the way it's supposed to be. Try using more than 1 axis
Vector3 lerp = Vector3.Lerp(new Vector3(100, 0, 0), new Vector3(0, 0, 100), a);
Vector3 slerp = Vector3.Slerp(new Vector3(100, 0, 0), new Vector3(0, 0, 100), a);
Notice a difference now?
Your answer
Follow this Question
Related Questions
Moving player in an arc, from startPoint to endPoint 2 Answers
How to Lerp or Slerp Time.timeScale change 1 Answer
If a rigidbody is attached, should you always use AddTorque/AddRelative force for rotation/movement? 1 Answer
Are there any easing functions built into Unity 5? 1 Answer
Make Quaternion Slerp happen over a 1 second period 3 Answers