Guillaume,

  After thinking about this some more it isn't so easy.  When I answered I
was looking at some code which manually intersects a ray and a single quad
from a generated ray, which does give the distance to the picked point.  It
is possible to do what you want but it will take quite a bit of code.
Maybe the Java3D team at Sun has a better solution???

1) pick the closest geometry using the mouse x,y
2) get the picked Shape3D from the SceneGraphPath object returned by
pickClosest
3) generate a ray using generatePickRay with the mouse x,y (the same ray
used to pick the Shape3D)
4) intersect that ray with all the quads or tris in the Shap3D's geometry
(this is a lot of code for all the different geometry types)
5) when you find an intersection use the distance, ray origin, and ray
vector as I described before to get your 3D point

I would provide this code but it will take a while and I don't need it
right now.  This is vital functionality so maybe Sun will put it in a
future release.  It would be MUCH easier to do this inside the pickClosest
code where the needed information should already be available.

Roger


At 03:48 PM 3/8/99 +0100, Roger Cottam wrote:
>Guillaume,
>
>  Just take the ray vector and scale that by the distance to the point
>picked, which is provided, and add it to the origin of the ray.  This
>produces the 3D point that was picked.  Here's the code:
>
>ray.get(rayOrig, rayVect);
>rayVect.scale(pickdistance[0]);
>pointpicked.set(rayOrig);
>pointpicked.add(rayVect);
>
>Roger
>
>At 08:56 AM 3/8/99 -0500, Guillaume Bilodeau wrote:
>>Hi,
>>
>>      Another small question...  When picking an object with a mouse behavior, is
>>there any way to get the point (Point3f/3d) that was picked?  There is such a
>>method in OpenInventor and probably in OpenGL, but I can't seem to find it in
>>Java3D.
>>
>>      If no such method is available, is there a work around?
>>
>>
>>      Thank you very much again.
>
>=====================================================================
>To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
>Java 3D Home Page: http://java.sun.com/products/java-media/3D/

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to