Hi I have an embarrassingly simple problem that I just can’t solve.
I am using Unity3D as a client and I have a server that uses an External 3D Math Library that includes Quaternions but does not included the method “Quaternion.LookRotation()” or anything that I can find like it.
So what does Quaternion.LookRotation() do exactly?
The best I could come up with after searching around the interwebs was…
Vector3 dir = (Target.position - transform.position);
Vector3 axis = Vector3.Cross(Vector3.up, dir.normalized);
float angle = Vector3.Dot(Vector3.right, dir.normalized);
rotationToTarget = Quaternion.AngleAxis(angle, axis);
//rotationToTarget = Quaternion.LookRotation(dir);
//transform.rotation *= rotationToTarget
transform.rotation = Quaternion.Slerp(transform.rotation, rotationToTarget, Time.deltaTime);
But this just rotates to ‘identity’?
I am missing something obvious and simple I know I am…
Not ‘strictly’ a Unity3D question exactly I know, but currently I have spent 3 days trying to work this out and it seems like it should be so simple.