So far I've been able to extract the data through a roundabout method,
but I don't have confidence in the result. I'm trying to find the
points in space where a ray intersects a mesh, but though it's in
world space and the ray should be passing all the way through the
object I'm apparently only getting 1 intersection at (0,0,0). I can
set it to "direction = Both" but in that case hitRayParams, which
should return the distance, shows two intersections at the same
distance, which I believe means it's just hitting both sides of the
same polygon.

hitPoints = om.MFloatPointArray()
hit = fnMesh.allIntersections(raySource, rayDir, faceIds, triIds,
idsSorted, worldSpace, maxParam, testBothDirections, accelParams,
sortHits, hitPoints, hitRayParams, hitFaces, hitTris, hitBarys1,
hitBarys2, tolerance)
hitPointsList = [om.MFloatPoint() for i in range(hitPoints.length())]
for x in hitPointsList:
  print "hitpoint:", x[0], x[1], x[2], x[3]

So how do I get all the intersections in world space?

Thanks,
p



On Feb 21, 2:57 pm, pjrich <[email protected]> wrote:
> I'm using a python wrapper of fnMesh.allIntersections, which uses a
> number of other wrappers including MFloatPointArray() -- when I try to
> get the contents of the array I only get a pointer to the array's
> wrapper (I think):
>
> <maya.OpenMaya.MFloatPointArray; proxy of <Swig Object of type
> 'MFloatPointArray *' at 0x23fed220> >
>
> I don't know enough about the API to use MFloatPointArray.get(), I get
> errors like:
>
> # NotImplementedError: Wrong number of arguments for overloaded
> function 'MFloatPointArray_get'.
> #   Possible C/C++ prototypes are:
> #     get(float [][4])
> #     get(double [][4])
>
> Is there an easy way to get these kinds of values with pymel, or to
> work with these wrappers in general, besides learning C++? The Maya
> API docs all seem to assume I already know it.

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to