- Home /
Animator.SetLookAtPosition is Inverted?
So I came across this issue which I think is a bug, but im not sure.
I setup a character with just an idle animation and a animator through Mecanim. Fully rigged and rig = humanoid.
Then in a script I dd:
public Animator anim;
void Update(){
anim.SetLookAtWeight(1);
anim.SetLookAtPosition (FirstPersonController.transform.position);
}
After I did attached the script to the character and moved close to them, I got this.
Almost like the LookAtPosition was Inverted. Any thoughts?
PS : I tried going between Global and Local Positions and used other objects (ie cube), no luck. It was still inverted.
I kinda can't believe it's inverted
what is it looking at you = the neck? or eyes what parent is looking and so on...
From what I know, $$anonymous$$ecanim should be using the I$$anonymous$$s that are setup on the rig to "look at" things. The object that I have the player looking at is the first person controllers position which is below the arms you see in the picture.
I could use the old method of Slerping the head position, but I wanted to keep everything within the new $$anonymous$$ecanim System.
It looks like the base of her skull is staring at your torso. You want her nose to stare at your torso. Since these two directions are exactly 90 degrees apart, this is likely due to mismatched bone axes.
The standard LookAt function uses transform.forward as the looking direction - if your head bone is vertical (in T-pose) and rolled properly, transform.forward is the nose. This looks like the head bone is horizontal.
I haven't used $$anonymous$$ecanim. Can you specify a looker object? If you can, you can make the head a child of your looker object and not worry about the bones. Otherwise you might have to go back into your skeleton and rotate the head bone.
Loius,
Yes, I agree with you about the standard look at function props. In the standard look at, when you placed the script on the object it was based off the "Forward" or Z axis. Ive come across that issue before and adjusted.
With $$anonymous$$ecanim, I cannot find a place to "Set" the Looker object since the everything is based in the "Animator". The weird thing is that the left and right looking is fine, but up and down is inverted. I will keep searching....