Hi, sorry if this has been asked int.Max times before.
I am setting a Quaternion with SetLookRotation(f, u) but the vectors I get back from the transform are different (and by more than a tiny amount too). Can someone please explain what I am missing here?
if (this.tf.forward != this.splineTangent)
{
this.tf.rotation.SetLookRotation(this.splineTangent, this.splineUp);
if (this.tf.forward != this.splineTangent)
{
Debug.Log("df " + (this.tf.forward - this.splineTangent).magnitude);
}
if (this.tf.up != this.splineUp)
{
Debug.Log("du " + (this.tf.up - this.splineUp).magnitude + " tan " + this.splineTangent.magnitude + " up " + this.splineUp.magnitude);
}
}
I see output like:
df 0.1523634
du 0.4578745 tan 1 up 0.99999999
Surely the fwd and up vectors should be unchanged (allowing for numerical errors)?
If this code is in fact JS (impossible to tell from the fragment :P), this may not be true, as Unity does implement some automatic workarounds for the ‘property returning struct’ issue.
Edit:
While orthogonality might explain your problem regarding ‘up’, foward should always match.