Jump to content

How to Change Head Location


h-shirakami

Recommended Posts

How can I temporarily rotate and move the HMD camera by myself in VIU?

I wanted to rotate the HMD's camera when an event occurred, so I rotated the ViveCameraRig, but I couldn't get the correct results.

I referred to Teleport in Examples.
It rotates the x-axis after moving forward, which is not the intended result. I think the cause is the movement of the camera. How can I change the camera transform directly?

 

teleport01.png

teleport02.png

teleport03.png

Link to comment
Share on other sites

Do you mean you want to rotate camera root around HMD?

public static void RotateAroundHMD(Transform vrOrigin, Transform hmd, Quaternion rot)
{
    vrOrigin.position = rot * (vrOrigin.position - hmd.position) + hmd.position;
    vrOrigin.rotation = rot * vrOrigin.rotation;
}

public static void OnSomeRightTurnEventOcurred()
{
    // Turn right around Y axis for 45 degree
    RotateAroundHMD(vrOrigin, hmd, Quaternion.Euler(new Vector3(0f, 45f, 0f)));
}

 

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...