Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
alvaroull's avatar
alvaroull
Protege
12 years ago

move object with rift

Hi,

how can I move an object with the rotational movement of the rift?
Similar to the "racket" plane of the Proton Pulse demo.

I'm tried to create the plane and linked to the the diferents cobjects..OVRPlayerController,OVRCameraController,etc...
but not works..

Thanks in advance

6 Replies

Replies have been turned off for this discussion
  • drash's avatar
    drash
    Heroic Explorer
    Good question, I'm not even sure how it was done in Proton Pulse. But, I imagine you would start with a position between CameraLeft and CameraRight, cast a Ray out in the direction of the rotation of one of those cameras (which is being updated from the Rift), until you hit a Collider and figure it out from there. Or maybe no Rays and Colliders involved, just vector math to figure out where exactly your view direction would hit an invisble plane in front of you (at which point you'd update the position of your plane a la Proton Pulse racket). Just depends on what you're trying to do. I doubt you can do it without custom scripting though!
  • "drash" wrote:
    Good question, I'm not even sure how it was done in Proton Pulse. But, I imagine you would start with a position between CameraLeft and CameraRight, cast a Ray out in the direction of the rotation of one of those cameras (which is being updated from the Rift), until you hit a Collider and figure it out from there. Or maybe no Rays and Colliders involved, just vector math to figure out where exactly your view direction would hit an invisble plane in front of you (at which point you'd update the position of your plane a la Proton Pulse racket). Just depends on what you're trying to do. I doubt you can do it without custom scripting though!


    Yeah this is how I would do it, cast a ray until it hit a plane with a collider, use the collision info to get the position, you could also use the normal if you want to align it with the surface of the collider.
  • dbuck's avatar
    dbuck
    Honored Guest
    easiest, may be to just add the object you want to move as a child of the camera controller...
  • I'm tried as a child, but don't works.

    Can somebody put a piece of code? I'm a few lost with the "ray acrooss"..

    Thanks in aavance
  • You can add the object as a child of CameraRight, and that will follow the view exactly.

    If you need something beyond that you will probably have to do something custom with the code.