Forum Discussion
bdeschryver
12 years agoExplorer
Forcing a predefined OVRPlayerController view/rotation
Hello guys,
I am building a script in which I am changing the location of the user (like predefined points of view in the scene).
No problem to set the position of the OVRPlayerController, but I am struggling with the rotation...
What I want to achieve is really to force the user to a specific camera view, so that after updating the position/location, the camera is turned toward a specific item.
I tried setting the OVRPlayController roration properties, but that does not work, as it is still reflecting the current Rift rotation.
I tried also setting the OVRCameraController rotation, but that does not work. I finally tried using the setYRotation function, no luck either...
Could you advice on how to update the OVRPlayerController rotation so that the user is facing the specific direction (probably ressting the current rotation values)
Thank you
I am building a script in which I am changing the location of the user (like predefined points of view in the scene).
No problem to set the position of the OVRPlayerController, but I am struggling with the rotation...
What I want to achieve is really to force the user to a specific camera view, so that after updating the position/location, the camera is turned toward a specific item.
I tried setting the OVRPlayController roration properties, but that does not work, as it is still reflecting the current Rift rotation.
I tried also setting the OVRCameraController rotation, but that does not work. I finally tried using the setYRotation function, no luck either...
Could you advice on how to update the OVRPlayerController rotation so that the user is facing the specific direction (probably ressting the current rotation values)
Thank you
12 Replies
Replies have been turned off for this discussion
- raidho36ExplorerYou just shouldn't do that.HMD angle is a camera offset from your actual angle.
- petereptProtegeI think this worked for me with a similiar scenario:
float direction = -120f;
// reset overplayer rotation
ovrplayer.transform.rotation = Quaternion.identity;
// set current forward rotation
ovrplayer.SetRotation(direction);
HTH,
Peter - bdeschryverExplorerraidho36, could you explain what not do that ?
I am well aware of the VR guidlines for proper experience, but here I want to have the user enter a scene by a nice fadein at some specific location with some specific camera direction...
Any idea how ?
Setting both the OVR player controller direction and the OVR cameracontroller direction (like setting the torso direction and eyes/neck direction)
Thanks - raidho36ExplorerYou didn't read the spoiler did you.
It said that the HMD angle is an offset off desired angle. - cyberealityGrand ChampionWhile it's possible to do this with some hacking, it is not recommended. If you rotate the camera by script, or lock the rotation, it will be a bad user experience. The better thing is to leave the control to the player and use contextual cues to guide them to look where you want. For example, you can have someone talking, or an explosion sound that will tell them where to look.
- bdeschryverExplorerWhat I don't understand is that it is possible to define the position and orientation of the OVRPlayerController in Unity so that when you start you game, it is placed and facing the direction you set.
Why could that not easily done during the game ?
Let's say for example that the user dies and need to restart the entire level at the starting point... how would you do that then ?
Of course I want to keep a good VR experience for the player. In this case, in some particular situation, the screen fades to black for 2 seconds and during that complete fade out, I want to move and playerController and set a new orientation, so that when fade in is done, the user is where I need to and looking in the requested direction...
What I don't get is why just rotating the main OVRPlayerController object does not rotate the camera view, as it is a child object of that one... - mrgreen72SuperstarI'm no Unity expert but this should be easy enough. I'll take a look when I get home if nobody has already answered you.
- boone188Honored GuestIf you call Start() on the OVRPlayerController after setting the rotation, that should do the trick I believe.
- mrgreen72Superstar
"boone188" wrote:
If you call Start() on the OVRPlayerController after setting the rotation, that should do the trick I believe.
That does the trick indeed.
Actually, what you need to do is set the OrientationOffset of the camera (which raidho36 hinted at) to your new rotation and also reset YRotation which is exactly what InitializeInputs() does. (Called from Start()).
Example:
GameObject Teleporter = GameObject.FindGameObjectWithTag("Teleporter");
transform.position = Teleporter.transform.position;
transform.rotation = Teleporter.transform.rotation;
OrientationOffset = transform.rotation;
YRotation = 0.0f; - bdeschryverExplorerthanks for this trick. I'll try that out and let you know !
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years ago
- 10 years ago