Skip to main content
Up and Coming
June 8, 2013

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
    This topic has been closed for replies.

    6 replies

    Inspiring
    June 8, 2013
    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!
    Titans of Space PLUS for Quest is now available on DrashVR.com
    sh0v0r
    Up and Coming
    June 9, 2013
    "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.
    Up and Coming
    June 9, 2013
    easiest, may be to just add the object you want to move as a child of the camera controller...
    Dave Buchhofer | Dev @ Matterport
    alvaroullAuthor
    Up and Coming
    June 12, 2013
    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
    Inspiring
    June 13, 2013
    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.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    June 16, 2013
    Adding to what CyberReality suggested, you could also lerp the child object. Depending on how you set it up, you'll get a pulling/dragging effect. It all depends on what you're looking for.

    Vector3.Lerp
    http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Lerp.html

    and...

    Transform.parent
    http://docs.unity3d.com/Documentation/ScriptReference/Transform-parent.html