Problem with Find look at rotation

Hi, i want to have an eye ball in my game that will always turn and point towards the player.

I have made a blueprint class and created this system If you are wondering why i take 90 of the z value, its because for some reason the pupil wasn’t facing towards the player.

This blueprint almost works, the eye turns left and right to look towards the player, however, the eye doesn’t look up and down, and i can’t figure out why.
Sorry if this is a stupid question and iv’e missed something obvious :slight_smile:

Some of the problem may be in your setup. I would create a scene component and then place the static mesh actor for the eye on it. The very center of your eyeball would line up on the scene component. You can now rotate your mesh to line up the x, y, and z so it looks straight ahead. No matter where your uv’s line up now, you will be able to set the eye properly without having to worry about subtracting 90 or adding to your lookAt rotation calculations. Set the scene component to rotate to the lookAtRotation instead of the Eyeball itself.

Also, I would get your scene component world location as the start instead of actor location. You may want the eye to look at his head versus his feet. I don’t know if that would be an issue for your game, but if so, target the location of a specific point/joint/socket of the player versus just the location, or add around 85 in the Z of the target location.

I know this is an old thread, but I had a similar issue and wanted to share in case it would help anyone. Firstly, thanks for your answer James94Hodges; it got me on the right track to solve this problem.

The mesh I needed to rotate to look had its X and Z axes swapped during the Blender Export/Unreal Import. Since the FindAtLookRotation function only sets the rotation for the Pitch and Yaw, this was where my problem was located.

I fixed this by manually setting the Pitch result of the function to the Roll input when setting my mesh’s rotation. I’m sure a better fix would be to re-import the mesh on the correct axes, but I’m still new to Blender and no export options (or Unreal import options) were helping remedy my situation. :confused:

2 Likes

This should be a public service announcement. Not even chatGPT could solve this for me.

Switching the X and Y axes; diabolical, yet elegant.