Forum Discussion
alvaroull
12 years agoProtege
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
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
- drashHeroic ExplorerGood 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!
- sh0v0rProtege
"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. - dbuckHonored Guesteasiest, may be to just add the object you want to move as a child of the camera controller...
- alvaroullProtegeI'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 - cyberealityGrand ChampionYou 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. - marcoromeroHonored GuestAdding 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
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
- 1 year ago
- 3 years ago