Inquire the LocalToVWorld transform for the Shape3D, inquire your Points and 
then transform them to VWorld coords.

Doug Gehringer
Sun Microsystems

> From: "Decker, Scott D" <[EMAIL PROTECTED]>
> 
> Okay, I have a picking question
> 
> I have a mesh that is composed of triangle strip arrays
> I need to find out which triangle area the user picks on
> 
> I first do an intersection test with the shape3D
> PickObject.pickClosest(xpos,ypos,PickObject.USE_GEOMETRY);
> 
> this returns a scenegraphpath (sgp)
> 
> I also generate a PickRay with the branch root, canvas and the xpos, ypos
> 
> Via the Shape3D I get it's TriangleStripArray
> then I get the number of triangles and loop like this
> for(i = 0; i < (vertex_counts/3); i++)
> {
>  tri_strip.getCoordinate(first_vertex,tri[0]);
>  tri_strip.getCoordinate(first_vertex + 1,tri[1]);
>  tri_strip.getCoordinate(first_vertex + 2,tri[2]);
>                               
>  first_vertex = first_vertex + 2;
>                               
>  hit = Intersect.rayAndTriangle(pickRay,tri,0,dist);
>                               
>  if (hit)
>   System.out.println("hit a triangle");
> 
> 
>                       
> }
> 
> I am going triangle by triangle right now
> The thing I am thinking about though, is that these triangle vertices are the
> original, non-transform vertices
> so, technically when I try the Intersect.rayAndTriangle pick, it is using the
> original vertices, but my view is all transformed to look at the data.
> 
> So, to get those vertices transformed right, what must I do to get the
> transform?
> Can I use the transform from the SceneGraphPath to transform each vertice?
> Or, do I have to use some other Transform?
> 
> Or, is there a better way to pick individual triangles?
> 
> Thanks
> Scott
> 
> Scott Decker
> Research Scientist
> Pacific Northwest National Labs
> [EMAIL PROTECTED]
> 
> =====================================================================
> 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