Vector3 vector3 = new Vector3 (0.0f, 0.0f, 0.0f);
Quaternion qTo = Quaternion.LookRotation (vector3);
transform.rotation = Quaternion.Slerp (transform.rotation, qTo, Time.deltaTime * turnspeed);
(See code above). If my LookRotation vector3 is zero in every axis, why does my this Slerp function I have here still rotate my character 90 degrees? I am just curious and honestly quite baffled. I can send screenshots if you need a visual representation of this.
Have a look at the definition of Quaternion.Slerp:
“Spherically interpolates between a and b by t. The parameter t is clamped to the range [0, 1].”
So as long as your current transform.rotation is not equal to zero rotation (Im honestly not sure if you get Quaternion.identity from LookRotation(Vector3.zero)), Slerp will return a value between these two rotations.
See Unity - Scripting API: Quaternion.LookRotation
You actually pass a forward vector into the method. Instead of crashing with your invalid vector, it seems to fall back to some default (probably Vector3(0, 0, 1)) and return that look direction instead. And that is the rotation you get.
If your character transform has a forward vector like Vector3(1, 0, 0) that would result in a rotation of 90° around the world y-axis.
Don’t you get an error in the console? The documentation says: “Logs an error if the forward direction is zero.”