Forum Discussion
Gerald
12 years agoExpert Protege
how to reset the view?
When the game starts the Rift is assuming the current position is the start position.
I would like to be able to override that in case you started at a bad position. But I am not sure what to call to do that. How can I reset the view?
I would like to be able to override that in case you started at a bad position. But I am not sure what to call to do that. How can I reset the view?
20 Replies
Replies have been turned off for this discussion
- petergiokarisProtegeHi Gerald,
There is a function in CameraController called SetOrientationOffset.
If you have not attached the camera to follow another objects Transform via the member FollowOrientation, upon the OVRCameraController construction, the OrientationOffset of the camera will be set according to the initial orientation of the camera. So, you can manually set this offset orientation via the above function to whatever orientation you please.
You might even consider actually resetting the tracker as well, via OVRDevice.ResetOrientation(0) (which will set the tracker to the identity quaternion orientation) and see if this gives you the granularity you are looking for to really force the camera into the direction you desire.
Best,
Peter - GeraldExpert ProtegeHi Peter,
sounds about like just what I was looking for. Thank you, that is awesome.
I don't follow another objects Transform, but have the Oculus Cam riding piggyback on my original cam. That way all the things I do to my original cam also affect the Oculus Cam. Works pretty well and makes integration into my games (which are not first person) really easy.
I will try that now :) - GeraldExpert Protegeperfect - works as I want it.
my game normally works with a camera looking into a fixed direction, so the drift was an issue as well as a starting position that did not work. this is now a simple and easy to do fix, many Leap Motion games will have the same issue.
now I can always reset it it by pressing a key.
if (Input.GetKeyDown("left ctrl"))
{
OVRDevice.ResetOrientation(0);
}
Thanks again Peter. I will look into how to integrate the new yaw correction at a later point. I am aware this is not the optimal solution. ;) - petergiokarisProtegeAwesome, I'm glad that it worked out for you Gerald!
- davidhensleyHonored Guest
if (Input.GetKeyDown("left ctrl"))
{
OVRDevice.ResetOrientation(0);
}
Hi guys,
thanks for this thread it has been helpful. Where did you put the reset line of code? I'm kind of a beginner at coding so its not obvious to me. I tried adding it in the SetOrientationOffset function. Does that sound right? - GeraldExpert ProtegeYou should have one place where you have all your keyboard inputs .... and there it is in the update loop.
- bwiklundHonored GuestI get this error:
Assets/Dolly.js(32,17): BCE0005: Unknown identifier: 'OVRDevice'.
What's the right way to get the reference to OVRDevice inside a script? - AdamsImmersiveHonored Guest
"bwiklund" wrote:
I get this error:Assets/Dolly.js(32,17): BCE0005: Unknown identifier: 'OVRDevice'.
What's the right way to get the reference to OVRDevice inside a script?
Same error and question here. I'm sure I'm looking right at the answer and not seeing it!
Thanks. - AnonymousI didn't look at the Unity package yet, but assuming that the function called ResetOrientation() is in a script called OVRDevice, wich is attached to a gameobject called "OVRController" or something like this, you should reference it in the dolly.cs script in the awake() function, for example :
private OVRDevice ovrdevice ; // This is the variable you'll use to reference the OVRDevice script.
void Awake()
{
ovrdevice = GameObject.Find(OVRController).GetComponent<OVRDevice>() ; // Here, we reference the script OVRDevice, attached to the gameobject OVRController, in our variable ovrdevice.
}
void Update()
{
if (Input.GetKeyDown("left ctrl")) // If the player press left ctrl (listed as an imput in Unity in the inputs window)...
{
ovrdevice.ResetOrientation(0); // ... we call the ResetOrientation() function of the OVRDevice script referenced in our ovrdevice variable.
}
}
Colours would have helped here, sorry about that. - AdamsImmersiveHonored GuestThanks! I was almost there but not quite...
(And I'll post a JS version for posterity as soon as I try that out.)
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
- 3 years ago
- 10 months ago
- 2 months ago
- 4 years ago