Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Altavere's avatar
Altavere
Honored Guest
13 years ago

[Solved] Help needed for camera orientation offset

Hi there,

In a project I’m working on, the player is a spectator who looks at the world below him. All works fine but after a while my neck starts to hurt from constantly looking down… :?
So I thought it would be better if I could watch a bit more straight forward but still see the same as if I was looking down.

I have practically zero programming skills but I’ve managed to rotate the cameras (30 degrees) in the OVR scripts. The result is satisfying and when I look around using the mouse, it works the way I want it to (I use the OVRPlayerController prefab). But when I start looking around by rotating my head, it goes predictably wrong. I guess it has something to do with the fact that I’m not rotating the cameras in world space or something? It would be nice if the result of rotating my head would be the same as moving the mouse. That way the perceived horizon would stay horizontal.

I’ve been trying for several days now without any luck, so I was hoping if you guys could help me out with this. Is there a relatively simple solution that a noob like me can understand or is this higher maths stuff?
Thanks in advance!

10 Replies

Replies have been turned off for this discussion
  • You don't need to do any math or programming for this. Here is what you should try:

    1. Create a game object called "Player" or something
    2. Rotate the game object to look down, by setting the X rotation to -30 degrees or something
    3. Add an OVRCameraController as a child of your "Player" object
    4. Find the "Follow Orientation" field in the OVRCameraController. Drag your "Player" object into that field.

    The orientation of your camera should now follow the orientation of your "Player" object, so it will be looking down.
  • "XswampyX" wrote:
    Have you thought about rotating your world?


    I did, but as you can imagine, this will result in even more problems as soon as you start looking around.
  • "boone188" wrote:
    You don't need to do any math or programming for this. Here is what you should try:

    1. Create a game object called "Player" or something
    2. Rotate the game object to look down, by setting the X rotation to -30 degrees or something
    3. Add an OVRCameraController as a child of your "Player" object
    4. Find the "Follow Orientation" field in the OVRCameraController. Drag your "Player" object into that field.

    The orientation of your camera should now follow the orientation of your "Player" object, so it will be looking down.


    Okay, that's indeed way more easy than I did with scripting but the result is the same: the camera is looking down but rotating the head still results in a tilting horizon.
  • "Altavere" wrote:
    "boone188" wrote:
    You don't need to do any math or programming for this. Here is what you should try:

    1. Create a game object called "Player" or something
    2. Rotate the game object to look down, by setting the X rotation to -30 degrees or something
    3. Add an OVRCameraController as a child of your "Player" object
    4. Find the "Follow Orientation" field in the OVRCameraController. Drag your "Player" object into that field.

    The orientation of your camera should now follow the orientation of your "Player" object, so it will be looking down.


    Okay, that's indeed way more easy than I did with scripting but the result is the same: the camera is looking down but rotating the head still results in a tilting horizon.

    Have you made sure that any changes you made to the OVR scripts have been reverted? Try re-importing the package.
  • Yes I did, the scripts are clean without my code :D
    Have you tried it yourself boone188? Did it work for you?
  • "Altavere" wrote:
    Yes I did, the scripts are clean without my code :D
    Have you tried it yourself boone188? Did it work for you?

    Yeah I've done this sort of thing many times. Hmmm.. Try setting "Tracker Rotates Y" to false if it isn't already.
  • "boone188" wrote:
    Try setting "Tracker Rotates Y" to false if it isn't already.

    Done that as well, it doesn't make a difference.

    Now I've tried a different approach by placing a dummy object in-between the OVRCameraController and both camera's, then I gave both camera's an x rotation and moved the OVRCamera script to the dummies. This gives me the desired rotation/orientation effect as I turn my head but now I'm missing the lens correction and it looks like I've decreased performance...
    Makes me think I'm almost there but I am not able to finish it, very frustrating :cry:

    Any other suggestions on how to make it work?
  • I did it!

    I just added
    transform.Rotate(30,0,0,Space.Self);
    in the OVRCamera script and now it works! It only makes me a little dizzy as well :lol:.
    It's kind of hard to explain what it looks like, but it works.

    For an acceptable experience, I've now combined 10 degrees offset in the old way, with 20 degrees in the thing above. Makes 30 degrees of horizon offset.

    Cheers