Notifications
Clear all
[Closed] SDK InterpCurve3D
Oct 12, 2015 6:08 pm
Hi, I am trying to put objects around a spline by using the InterpCurve3D. My issue is that my Maxscript version works perfectly, its all evenly spaced etc. But the C++ version, will place all the objects around the spline, but they are not evenly spaced out. Anyone know why ? I shall put both codes below:
Maxscript
pth = $Line001
obj = $Box001
copies = 50
for i = 0 to (copies-1) do(
perc = (i as float / (copies-1))
pnt = interpCurve3D pth 1 perc
print(pnt as string)
b = instance obj
b.position = pnt
)
C++
INode* spline = pblock2->GetINode(Spline_Node, t, FOREVER);
if(spline != NULL){
int copies = 50;
for(int i = 0; i < copies; i++){
float perc = (float)i/(copies - 1);
ShapeObject* shape = (ShapeObject*)spline->GetObjectRef();
Point3 pnt = shape->InterpCurve3D(t, 0, perc)*spline->GetNodeTM(t);
INode* geo = pblock2->GetINode(Objects_Tab, t, FOREVER, 0);
Object* obj = geo->GetObjectRef();
INode* newNode = ip->CreateObjectNode(obj);
Matrix3 tm(1);
tm.SetTrans(pnt);
newNode->SetNodeTM(t, tm);
}
}
2 Replies
Oct 12, 2015 6:08 pm
try this:
Point3 pnt = shape->InterpCurve3D(t, 0, perc, PARAM_NORMALIZED);
just guessing…
guruware