Body is spinning around when head looks upwards


I’ve never seen this issue or any solutions but when I was following this video Inverse Kinematics in VR: How to Use Unity to Control Your Arms and Hands - YouTube to get a vr head going, it does this weird thing I can’t seem to fix no matter the setting or the model I use. The head follows the view of the camera but when you look upwards to a certain degree the whole torso flips around, even though the arms indicate they’re still on the other side. I’m new to VR, but this has been plaguing my project for weeks! I’ve tried:

  • editing the script
  • a different model
  • changing the offsets of the camera-head
  • adding/removing the constraints in the multiparent constraints
  • changing the constrained object to from the head to neck, top of head, eyes, etc.
  • changing the constraints within the model
  • more???

Here is my Head script:
using UnityEngine;

public class Head : MonoBehaviour
[SerializeField] private Transform rootObject, followObject;
[SerializeField] private Vector3 positionOffset, rotationOffset, headBodyOffset;

private void LateUpdate()
    rootObject.position = transform.position + headBodyOffset;
    rootObject.forward = Vector3.ProjectOnPlane(followObject.up, Vector3.up).normalized;

    transform.position = followObject.TransformPoint(positionOffset);
    transform.rotation = followObject.rotation * Quaternion.Euler(rotationOffset);


Please someone help with this! For some reason I’ve only found 2 tutorials for making a head work in VR and neither worked for me.



I recently got back into game dev because of VR, I was following the same tutorial and ran into a similar issue. The only difference was my body was turning 180 degrees when I looked down. I was able to fix it by changing one line of code. The change can be seen below.

Original Line:

rootObject.forward = Vector3.ProjectOnPlane(followObject.up, Vector3.up).normalized;

New Line:

rootObject.eulerAngles = new Vector3(rootObject.eulerAngles.x, followObject.eulerAngles.y + rotationOffset.y, rootObject.eulerAngles.z);

The .eulerAngles function can be used to set and retrieve the rotation values of a transform. I figured I would just set the X and Z equal to themselves and set the Y equal to the Y of the main camera. I had to offset the rotation for my body the same amount as I did for my head, so I used the same variable. Just adding the offset like I did seemed to work for my use case.

I hope this can be of some help for someone.