Forum Discussion

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

[UNITY]Getting the Oculus Camera to rotate around an object?

Hello!

This seems simple enough but I can't seem to find a solution. I need the camera to orbit around an object when you rotate your head and always remains looking at it. For example, when you look down with the Rift, the camera orbits above the object. When you look up, it looks under the object. This means an object is displayed and you can look all around it, your head rotations match how the object is rotated.

A simple solution, I believe, would be to move the camera pivot point to the object (at 0,0) with the camera a little bit away so when it rotates, it rotates around the object instead. Is this possible?

Any and all advice is appreciated!!

4 Replies

  • Jago69's avatar
    Jago69
    Honored Guest
    Never tried it, but I think it would be better to move the camera position.
    If you determine the direction where the camera is looking, you can normalize that vector, multiply it by the distance you desire it to be from the object, reverse it and add it to the object coordinates.
    That should give you the coordinates where to move the camera position.
  • Do you intend to give away free barf bags with your application? :)
  • "nuclear" wrote:
    Do you intend to give away free barf bags with your application? :)

    Actually, this concept is not as crazy as it sounds. You can see the same effect in 3rd-person view in Minecrift and I find it quite pleasing to use.
  • "paddyschiller" wrote:
    Hello!

    This seems simple enough but I can't seem to find a solution. I need the camera to orbit around an object when you rotate your head and always remains looking at it. For example, when you look down with the Rift, the camera orbits above the object. When you look up, it looks under the object. This means an object is displayed and you can look all around it, your head rotations match how the object is rotated.

    A simple solution, I believe, would be to move the camera pivot point to the object (at 0,0) with the camera a little bit away so when it rotates, it rotates around the object instead. Is this possible?

    Any and all advice is appreciated!!



    Duuno if this relevant but I wanted to do something similar with my castle project.
    I wanted to be able to orbit it and face it at the same time.

    To do it I used Max but any 3d prog will be ok.

    First i created a small box.but any small object will do...then I created a circle path or spline..then i used "follow path" to animate the box.
    The box now runs around the circle!
    Do not worry too much about the diameter You can alter that in Unity with Scale.
    Now to make sure the same face of the box always faces into the centre I also rotated the box 360 on it's own axis as the box rotates around the circle.
    That is important or you will lose the centre !!!

    Then I imported the animation (FBX) into Unity.

    The parented the camera to the box.

    Depending on the amount of steps used in the circle path...so depends the speed of rotation.
    Depending on the scale of the circle path...so determines the distance from the object.

    You place this rotater thingy where you like. Probably with the centre over the Unity object you wish to view.

    If you are courageous enough to experiment with this you could import many such animations of both different lengths and orientations and assign a script to switch both speeds and origination.
    They need not be rendered/seen.
    ,,,Or just use Unity to scale and revolve the path as you wish.