I have no idea whats happening here but need a solution. Its a very simple task - I have an empty that contains an armature/body mesh that I move around using ITween, and I need the body to rotate to face the object it is moving towards.
My problem is my armature inside my container object has z axis up, and for whatever reason using any lookAt rotation for either the child armature or larger container is off by 90 degrees so the left side of object is facing the target.
I've tried:
Vector3 relativePos = test.transform.position - transform.position;
Quaternion rotation = Quaternion.LookRotation(relativePos);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * 1f);
Ive been trying to use both LookAt and iTween, none work. I know that iTween is working on rotation because this makes the object rotate by 90 degrees on the z axis (I just need the object to face the target on the Vector3.up axis - where mainModel is the armature:
iTween.RotateTo(mainModel, iTween.Hash(
"z", this.gameObject.transform.eulerAngles.x + 90,
"time", 1f,
"easetype", "easeInOutSine",
"looptype", "pingpong"
));
iTween either doesn't work when I replace with a LookRotation at the target, or faces to left.
How get I offset the LookRotation by 90 degrees on the up axis? What is wrong here?
transform.LookAt(test.transform.position);
, the only problem is that it's looking left? – Ruzihm