Download

Help needed for head and eyeballs lookat

Hello all -

I am currently working on a character using the Epic Male skeleton and the Third Person controller from the example project. Everything is working as intended but I would like to give the character more life by making either its eyes or its head always point forward in the direction of the input/capsule. That way even if the head tilts down during a sprint animation, the character would still look straight ahead thanks to either the eyes or the neck being dynamic and consistent with the overall movement direction.

Summary of what I have :

Two sockets have been added to the head bone, and 2 copies of an eyeball skeletal mesh (with a bone at its center and pointing forward) have been snapped onto these sockets in the scene.

There are two solutions I can imagine : Either making the eyeballs point forward (with a clamp angle of roughly 40 degrees on the two affected axis) ; or, overriding the head bone rotation and making this point forward (with a clamp of about 80 degrees on the needed axises). I am not sure which one would look the most natural.

In other words I need to be able to access the direction of the Third Person controller, and apply that to the eyeballs or head bone … with some clever math to clamp the values when the head animation turns away too much from the main direction, and all that without any odd flipping.

I would appreciate any help on the matter. I am comfortable with node creation and simple operations within the material editor (masking and lerping textures, using multiply for color tinting, and so on) but I have zero experience with dynamic blueprints. I suppose that most of the answers are already in this thread Eye contact - VR and AR Development - Unreal Engine Forums but I would need more detailed instructions. Tagging user @knack for help.


Also a side question regarding sockets : besides the eyes the character will also have other sockets for weapon attachment, accessories, and so on. In Unity one can create complex hierarchies and then set them as “prefabs” for the end user to access easily. Is there an equivalent in UE ? I can of course attach these elements just fine in the scene using socket snapping, but what is the preferred way to organize the character/project for the end user ?

Thanks !

You can create an aimoffset for your character’s head bone. Either for yaw or both pitch and yaw. Then you can feed it those angle values in the AnimInstance graph and that would work.

Just look up any docs or tutorials that show setting up an aimoffset for a weapon etc and use it instead on the head bone.

Hi @Waves, that does make a lot of sense and that’s definitely something I’ll be looking into. However I am running into another issue which prevents me from making any progress : while attachment to skeletal meshes works fine (using direct parenting using Settings > Enable Socket Snapping, and also using AttachToActor in the Level Blueprint), I have been unable to attach anything to the actual player character.

Here is a detailed breakdown of what worked (skeletal mesh attachement) and what didn’t (player attachment) :

Any help would be appreciated, as once that is solved I will then be able to start working on the subtle eye and/or head lookats.

Thanks !

Update - I just managed to get the player attachment part to work, thanks to the following setup :

Meaning that I can now start looking into the original topic of eye/head lookat now, so that’s a good start.