[x3d-public] Pick object by an arbitrary ray?

Oleg K Dzhimiev oleg at elphel.com
Tue Jun 6 16:25:03 PDT 2017


Hello,

I would like to get the picking position/object(shape) for a vertical ray.
Is there a way to do this?
(Working on a map-to-x3dom interactions.)

The ray example (vertical from the sky):

> var from = new x3dom.fields.SFVec3f(any_x, 1000, any_z);

var dir    = new x3dom.fields.SFVec3f(0, -1, 0);

var ray = new x3dom.fields.Ray(from, dir);


a. There's a *elem.runtime.shootRay(cx,cy)*; It works but it's bound to the
canvas = the shape has to be in the view.

b. Tried to access the scene and run *doIntersect()* - it does not work:

scene = *elem.runtime.canvas.doc._scene;*
> var isect = scene.doIntersect(ray); // isect returns true but the hitPoint
> is incorrect at least for my model.


Comment: the shapes do not have DEFs. Trying to understand the from the
source if it's important.

Thanks.

Best regards,
Oleg Dzhimiev
Electronics Engineer
phone: +1 801 783 5555 x124
Elphel, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170606/6c4ea11f/attachment.html>


More information about the x3d-public mailing list