Force VR rotation

I have a game where the character finds an object. After finding an object, the screen goes black for a few seconds and the player starts in a new location facing a new direction. My script works fine in non-VR mode.

However, when the VR is on, the head rotation for oculus takes over and I can’t restart my character facing a new direction. Rotating the character or mouse look with the following scripts does not work during VR:

void OnTriggerEnter (Collider other) if (other.gameObject.tag == "coin") { FPC.mouseLook.m_CameraTargetRot = Quaternion.Euler(0f, 180f, 0f); }

void OnTriggerEnter (Collider other) if (other.gameObject.tag == "coin") { transform.rotation = Quaternion.Euler(0f, 180f, 0f); }

I should emphasize that the screen will be black during the forced rotation. So a person playing the game won’t notice the rotation until the black screen disappears. So the forced rotation will not cause nausea or motion sickness.

The only way I can get this to work is to turn off the VR during the black screen, rotate the character, and then turn the VR back on. However, there’s a little noticeable lag during the black screen. And turning the VR on and off throughout the game seems to slow things down.

Hi, @jaridgoodman:
I’m having the same issue. My next “experiment” consists on using a direct parent to the camera so it is its rotation the one changed. Not sure of how that would affect the Forward and Right vectors for later calculations. But I hope it is possible to achieve the forced rotation. Good luck!! And please post if you find an answer :slight_smile:

Yeah, most libraries set their VR camera position, so you really can’t interfere with it. I think they are set in local space though, so placing the camera inside another GameObject is certainly worth trying. It works like a vehicle your VR camera sits in - you can then rotate the vehicle and the camera should move to suit.

Otherwise you can do the opposite - rotate your world around the VR camera by placing it inside a GameObject. But that isn’t likely to be friendly with static batching.