How do I make "Look At" work properly
I am trying to use the "Look At" node to make my character look at the camera when my toggle is on.
When I toggle the Look At off and on for the head it works fine. The character's head faces the camera like it should.
(See image below)
When I toggle the Look At off and on for the eyeballs, it also works fine. The character's eyes point to the camera like they should.
(See image below)
However, when I toggle the Look At off and on for both the head and the eyeballs, the head looks at the camera like it should, but the eyeballs just point to the bottom right of the screen. In fact, if the head is pointing in any direction other than the default straightforward, the eyeballs will not look at the camera like I want them to. They will continue to point to the bottom screen right of his face.
(See image below. One head is tilted to show that the eyes always point to the lower screen right and not at the camera when the Look At for the eyeballs is toggled on)
This is my Character Blueprint Event Graph setup below:
(Ignore the Set Delta Seconds Node. That was for something else)
This is my Animation Blueprint Anim Graph setup with the Look At node selected showing the details I set on the right.
My goal is to make the Eyeballs focus on the camera no matter how the head is tilted and turned.
Any help is greatly appreciated.
I figured it out! Or I figured out a workaround at least.
I subtracted the head's rotation from the eyeball's rotation and got the eyes to look where I wanted them to look.
I put a socket on the nose bone between the eyes then used the "Get Socket Rotation" node in the "Character Blueprint" on that socket. (See picture below)
I did the math using blueprint nodes to get the difference between the initial socket rotation and the rotation after the head turns. (See picture below)
Then I plugged the resulting rotation into the "Transform (Modify) Bone" node in the "Anim Graph" of the "Animation Blueprint". This basically neutralizes the eye's rotation so no matter how the head is rotated, the eyes will look straight ahead. Then I plugged the "Look At node into the back of the "Transform (Modify) Bone" node and it worked.
(See picture below)
answered Dec 01 '18 at 04:58 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here