Forum

How to pick_object at central position in HMD

12 August 2016 15:07 #11201
Hi!
We developed a simple scene and we ran it into hmd cardboard environment with the
stereo: "HMD"
configuration, the new hmd_conf allows us to set webVR preset easily and the out of the box working gyro is awesome! so far so good!

We noticed that it's not possible to use the pick_object method in such configuration, probably that's disabled because of the camera barrel distortion and the consequent difference between the distorted and undistorted position (distortion managed by the browser).
In other cardboard demos we are used to a "click at the looked object" mode to interact with the scene by using the cardboard button.

By removing the
stereo: "HMD"
the
pick_object(canvasWidth/2 , canvasHeight/2)
works as expected also with the gyroscope, but not in the splitted screen hmd view.

Maybe an hypothetical "pick_object_hmd()" function could pick only the central point that's not distorted by the cardboard barrel…

We saw the space disaster demo, with the math for collisions but the pick_object is so straightforward in this case, so we tried to achieve this behaviour by using the calc_ray() but that returns an exception because this function is not allowed with this camera configuration

Is there a way to interact with the scene simulating a click at the canvas center at the actual development state?
Have you got an advice for us?
TY!!

Luigi
http://www.cineca.it/en
12 August 2016 17:38 #11212
hi!
We noticed that it's not possible to use the pick_object method in such configuration, probably that's disabled because of the camera barrel distortion and the consequent difference between the distorted and undistorted position (distortion managed by the browser).
Yes, we disabled the ability to pick objects because of that kind of problem, but we intend to solve this issue eventually.

We saw the space disaster demo, with the math for collisions but the pick_object is so straightforward in this case, so we tried to achieve this behaviour by using the calc_ray() but that returns an exception because this function is not allowed with this camera configuration

Is there a way to interact with the scene simulating a click at the canvas center at the actual development state?
Have you got an advice for us?
Yes, the calc_ray() is disabled in stereo mode too, but you can do the trick:
- create the secondary camera in your scene
- after the application starts attach it to the main camera by using the append_stiff function from the constraints module, for example:
var main_cam = m_scenes.get_object_by_name("Camera");
var sec_cam = m_scenes.get_object_by_name("Camera.001");
m_cons.append_stiff(sec_cam, main_cam, [0, 0, 0]);

So, from this point the secondary camera will always have the same position as the main and the same view. Moreover, it can be used with the calc_ray function, because when you turn on the stereo mode only the main camera (that's used for the actual rendering) transforms into the specific hmd camera, others stay unchanged and get no restrictions.
Blend4Web Team
16 August 2016 11:01 #11252
happy to ear that you are considering the issue! The secondary camera would do the trick I hope.. That's a cool workaround, It could be useful also for other things!

Thanks!
http://www.cineca.it/en
 
Please register or log in to leave a reply.