Last active
March 5, 2021 12:38
-
-
Save hdlx/271eff183ab5400828a155a55b1692dc to your computer and use it in GitHub Desktop.
Revisions
-
hdlx revised this gist
Aug 23, 2019 . No changes.There are no files selected for viewing
-
hdlx revised this gist
Aug 6, 2019 . No changes.There are no files selected for viewing
-
hdlx revised this gist
Jan 18, 2018 . No changes.There are no files selected for viewing
-
hdlx created this gist
Jan 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import maya.api.OpenMaya as om import maya.cmds as cmds #Returns normal, tangent, at a given point on a curve, given the curve and a position in space. #result as a list of openmaya MVector() def getCurveNormal(mayaCurve, pos=[0,0,0]): selectionList = om.MSelectionList() selectionList.add(mayaCurve) dPath= selectionList.getDagPath(0) mCurve=om.MFnNurbsCurve (dPath) res=mCurve.closestPoint(om.MPoint(om.MVector(pos)),space=om.MSpace.kWorld) point=om.MVector(res[0]) param=res[1] n=mCurve.normal(param,space=om.MSpace.kWorld) t=mCurve.tangent(param,space=om.MSpace.kWorld) li=[n,t,point] return li