I’m trying to create a system where the player character’s head follows the direction of the camera that i’ve attached to it. I’m nearly there, but there is an issue i can’t seem to wrap my head around. Whenever my character is facing the default spawn direction it will work as expected and follow the camera’s rotation as shown below:
I’ve been trying to fix this issue for the past couple of hours, but i can’t seem to find an answer myself. I’m guessing it has something to do with relative vs. world rotation, but i can’t for the life of me figure out how to change the blueprint so that it works properly.
Below is shown how i currently have my blueprint setup:
what we are looking for is the generic yaw for the head based on the camera / player controller view as input is used the root component. you can also use the world rotation of the character (skeletal mesh).
How does it work? the coordinate system goes from (left to right) -180 to 180, after 180 it snaps to -180 and vice versa. both coordinate systems are always based on the start rotation of the character.
In this solution we want to subtract the character world rotation from the controller / camera rotation, then we need an exception handler if the value is lower -180° or upper 180° Deg. So we add or subtract 360° f.e. if we rotate the camera to 180° and our character is at 90° we would be at 270° but we should be at -90°.