I have a blender object with armature which is not coopoerating in a good way with the look functions so let me illustrate. Pictured is a walking mech in editor and in play mode. The problem is obvious. I have had to rotate the turret into a weird position to get the lookat function to rotate it properly but when I rotate it in a script, all is well
Here is a script segment which is working with the layout
var targetPoint = FindClosestWaypoint().transform.position;
var targetRotation = Quaternion.LookRotation(targetPoint - transform.position, Vector3.up);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0);
If I change the mech so that in rest mode He looks normal, when I play, his head tilts 90 degrees.
If I just make the head turn like the exorcist like this:
transform.Rotate(Vector3(0,0,rotationAmount));
That’s fine
The head, or turret bone is the child of an empty which is where the script to turn it is located.
I have really tried looking for a solution but cannot figure it out. Have tried LookAt as well as LookRotation as per the segment above
Any thoughts?