You could sort the meshes in a spatial partitioning data structure and then
test the bounding boxes for intersections first, then do the mesh
intersections.  The individual meshes themselves could also be organized in
their own spatial data structure to do ray/triangle intersections.


On Mon, Jun 18, 2012 at 10:05 AM, Mathew Schwartz <umca...@gmail.com> wrote:

> To abstract the situation, i have some large plane say at y=0 (up axis is
> y), ontop of the plane i have some objects, from y=2 to y=3.  from any
> location on the y=5 plane, i want to find out if there is an object below
> it or if it is a clear path to the plane at y=0.
>
> So i am using the openmaya.intersect(), and it works well to get the
> location of the intersection.  Now, i really want to be getting the closest
> mesh that intersects with my ray, and if that is the 0 plane then i know
> theres no obstruction.  From what I understand of all the intersect
> methods, i need to be giving a mesh and then checking if that mesh
> intersects.  What i want is to just find out the closest mesh that gets hit
> by the ray.
>
> I have this code that works, but its super slow when I have alot of
> objects in my scene and i need to test multiple locations.  Any idea how to
> speed it up?
>
>
> thanks,
>
> mat
>
> http://pastebin.com/ZKPCGP7r
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to