"Find look at rotation" - how to transform from world space to bone space?

The character can follow an object with his/her eyes.

The Skeletal mesh has two bones for the left and right eye, which I can rotate to the direction of the object of interest.

I’m using “Find look at rotation” to find the world rotation for the eyes of my character. This works great.

But: I want to constrain the max and min rotation of the eye. If I use world translation and the object is behind the character, the eyeballs will turn to the back and “look inside the brain”.

To constrain the eye rotation I thought I would need to calculate the world rotation from the “Find look at rotation” to the local bone rotation. However, my vector maths failed badly so far.

Is there any Blueprint or C++ function that allows me to calculate the local bone rotation from a given world rotation?

Hi btengelh,

You should be able to clamp the min/max rotation values of your eyes by accessing a “get bone rotation by name” node.

This indeed looks like what I need. But: the character is a SkeletalMeshComponent. The “get bone rotation by name” needs a “PosableMeshComponent”. Am I missing something?

You should be able to get the skeletal mesh from your actor and use that.

it only exists for posable meshes (I’m on 4.6):

23455-getbonerotationbyname.jpg

Hi , can you please help me? I need it for Skeletal Meshes, but the Blueprint only exists for Posable Meshes. Do you know if it could be “easily” converted to use Skeletal Meshes using C++ ?

Hi btengelh,

Unfortunately I was wrong. You are correct in that that node is for poseable meshes only. However, you can get around this by adding a socket to your bone and then simply getting the socket rotation. This should work for what you are trying to do.

Ah… sockets gave the decisive hint. Don’t know why I didn’t think of using them earlier…

It’s now totally different from what I thought would work initially. I calculate everything in world space now and attached two sockets in front of the eyes BUT to the head bone. Then I feed the delta rotator with the vectors, the rest is easy.

Thanks !