LookAt axis for Blender

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

852-mechatrest.png
853-machwalking.png

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?

Okay, problem solved

The object was made in Blender, to make the turret aim, I had to make an empty parent for the controller bone, that fixes the axis problem, then I had to specify an axis in the Look function as per the below

var targetRotation = Quaternion.LookRotation(targetPoint - transform.position, Vector3(0,1,0));

transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0);

Presumably LookAt() needs an axis specified the same way