[Closed] interpCurve3D not working
interpCurve3D works on spline itself perfectly, but not gonna works when I modify the spline with modifers like SplineIKControl.
delete objects
-- Spline
Spline = splineshape wirecolor:yellow
addnewSpline Spline
for P in #([0,0,0],[50,0,50],[100,0,0]) do addKnot Spline 1 #smooth #curve P
updateShape Spline
HelperList = for i = 1 to 3 collect point box:on cross:off wirecolor:orange
addmodifier Spline (Spline_IK_Control linkTypes:2 helper_list:HelperList) ; classof Spline
P = point wirecolor:green
-- works:
P.Pos = interpCurve3D Spline 1 .5
HelperList[2].pos = [80,0,80]
-- not working anymore:
P.Pos = interpCurve3D Spline 1 .5
surprisingly dotnet version works (but of course too slow!)
fn DotNet_InterpCurve3D theShape Prm =
(
maxGlobal = (dotnetclass "autodesk.max.globalinterface").instance
inode = maxGlobal.COREInterface14.GetINodeByHandle theShape.inode.handle asdotnetobject:true
iobj = (inode.EvalWorldState maxGlobal.COREInterface.Time true asdotnetobject:true).Obj
pos = iobj.interpCurve3D 0 0 Prm 0
[pos.x,pos.y,pos.z]
)
Before the dotnet example ,
I taught that the answer lays on the definition of the interpCurve3D which says “Returns a <point3> coordinate on the indexed curve”.
it means whiteout any modification just the indexed spline, if you use modifier for example bend or stretch you’ll see the same result.
Then you can use lengthInterp instead.
But why the dotnet version working ? that is a good question.
Never thought about “numbered” or “indexed” curves. would you please tell me the difference? About the lengthInterp, is not accurate and increasing steps to the very high value will slow down the process.