Hi, 

am struggling a little with MfnMesh stuff. I have the coords of a point in 
space and i want to be able to fire off a vector from this point with direction 
in negative x. and then i want the script to print the coords of any collision 
points with a mesh.

here is some code i found which comes very close to solving it. but im just not 
smart enough to adapt slightly.

create a polySphere and run this:
#########################################

import maya.cmds as cmds
import maya.OpenMaya as om 

def returnCollisionPoints(point=(10.0,2.0,3.0), dir=(-1.0, 0.0, 0.0)):
    sel = om.MSelectionList()
    dag = om.MDagPath()

    #replace torus with arbitrary shape name
    sel.add("pSphereShape1")
    sel.getDagPath(0,dag)

    mesh = om.MFnMesh(dag)

    point = om.MFloatPoint(*point)
    dir = om.MFloatVector(*dir)
    hitPoints = om.MFloatPointArray()
     
    mesh.allIntersections(
            point, dir,
            None, None,
            False, om.MSpace.kWorld,
            10000, False,
            None, 
            None,
            hitPoints,
            None, None,
            None, None,
            None
        ) 
    return hitPoints

print returnCollisionPoints()
################################################

so it to be able to print out hitPoints as coordinates i guess. Does anyone 
know how to do this?

thanks alot, 
Sam

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/61624cc7-7d25-4479-a8e1-a732cd299c09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to