How to rotate the player parent, head visual, upper body visual, and lower body visual separately?

Hi, I’ve been trying to work this out for a good part of 3 days now and have tried so many different methods and been unable to find a solution.

I have a third person game where I’m using playerObject.forward = Camera.main.transform.forward.XZUnitVec(); to rotate the player parent along with the camera on Y axis when right click is held, however I want to add some extra functionality where:

  • The player parent and player’s head will follow the camera on the Y axis.
  • The lower body will only rotate along with the camera when there is more than 80 degrees difference between their rotations.
  • The upper body will follow behind the head, sitting halfway between the rotations of the head and the lower body.

Below I have included a diagram of what I’m looking to create, basically the parent’s “.forward” and the head follows the camera, the upper body sits halfway between the angles of the lower body, and the head, and finally the lower body does not rotate at all unless the angle between it and the head exceeds 80 degrees, where it will proceed to rotate that direction at the same speed to maintain the 80 degree angle, if the camera rotates back the opposite direction, the lower body will no longer move until the angle reaches 80 degrees in the other direction and then it will proceed to rotate and maintain the 80 degree angle once again.

Getting the head to follow the camera is easy enough, but I’ve been having a lot of trouble trying to work out how to keep the player visual’s lower body in place, check if the angle between it and the camera/parent/head is about to exceed 80 degrees, and then only rotate it enough to prevent the difference from exceeding that limit.

EDIT: It won’t let me directly include an image, so here’s a link to the diagram Imgur: The magic of the Internet

Problem resolved, had to ask on reddit because I guess no one saw this post here.