There are tons of tutorials on how to make the head rotate to the camera view but there’s one issue i can’t resolve, it does not take in account it’s own orientation in the world.
What i mean is that if your character is prone on belly, back or sides, or in ragdoll from an explosion or generally you have a leaning mechanic, the head rotates as the character and the head are in upright position. I can’t seem to figure out how to take in account how the head is actually rotated to account for that. E.g.
if you are prone on your right side and you look up, the head should rotate left of it’s body that would result in looking in the direction the camera is facing, but instead the head rotates up which in perspective seems as the character is looking right from your view.
I tried setting the modify bone rotation to ‘replace existing’ and to use ‘world space’ but that has issues of its own of course. Mainly, it would override any anims and the head always keeps upright when on the side (which i could probably solve by adding to the rotation by the amount the body is rotated in world space) but for some reason it doesn’t keep the head upright when leaning - rotating spine bones in ‘bone space’ and ‘adding to existing’ to lean behind cover.
The head tilts with it and somehow it doesn’t make sense to me since the head is set to world space - replace existing.
If i can’t do it by code, my next solution would be to try edit the mannequin skeleton to add a head IK bone and try use IK nodes to try rotate it properly relative to body orientation but i’m not sure if that would work either tho. Any ideas/solution for this? Anyone perhaps have a snippet how to account for the actual head orientation in world?
Here’s my base rotation logic in Anim BP.
Transform (Modify) Bone using ‘Add to existing’ and ‘Bone space’.
Transform (Modify) Bone using ‘Replace existing’ and ‘World space’.