Move an object along the x-axis of view in VR Camera.
In a VR application, I have an object e.g. BOX. What I want is that when the player will see the scene in 360, that BOX should follow the current view in x-axis only.
In other words, in VR app having a Main Camera(Right + Left), when scene is viewed in 360 then what co-ordinates are changing. Actually during the view around 360 the camera transform does not change.
If I make this BOX as child of Main camera, it will follow the camera view completely. But I want it to follow on x-axis only. On y and z it should remain fixed.
Answer by gameplay4all · Mar 30, 2017 at 09:37 PM
If you want to move it to the right (x-axis) relative to the camera, simply use camera_transform.right
. If you want it to stay at a certain line (the x-axis for example) but stay as close as possible to the camera, you should use something called a (perpendicular) projection. It's a relatively easy piece of vector math that always comes in handy with game development, I find. Look it up :) (You are specifically looking for the length of the projection vector)
This may be a bit too much and there might be an easier solution to your problem (or I might have misinterpreted your problem in the first place)
Good luck!
-Gameplay4all
Actually it is a VR application and has some Buttons. I want that whenever user sees below, he should get those buttons. So in whole 360 degrees, at any view when user sees below, he should see those buttons. I am not using latest GVR sdk, it is older cardboard sdk.
I just found that it can be done through RayCaster. But don't know how :(
Hey, I'm really not an expert on the new UI system nor do I have experience with VR. So I won't give an answer that I'm uncertain of. Ins$$anonymous$$d, I think you'll find this blogpost very useful: https://developer3.oculus.com/blog/unitys-ui-system-in-vr
Your answer
Follow this Question
Related Questions
Attaching Main Camera to a livestreamed avatar from Xsens 1 Answer
Cardboard camera issues 1 Answer
Unity 5.3.1p3 - Viewports on Render Textures are warped when Virtual Reality Supported is enabled. 0 Answers
GEAR VR Swipe 0 Answers
[GEAR VR] Character won't walk in the direction your facing 0 Answers