Notifications
Clear all
[Closed] C++ Spline Knot Points
Jul 20, 2015 12:43 pm
Hi, I am trying to get the points of a Spline and place Pointer objects in the same position. I can create the Points using the spline, but they are not positioned on the spline, but slightly off. Even if I move my Spline and rerun the code, its still in the same place. Have this got to do with World space ? Anyone know why ?? Code below:
Object *newObject = node->GetObjectRef();
BezierShape* s = &((SplineShape*)newObject)->shape;
Spline3D *t = s->splines[0];
Object *newPoint = (Object*)ip->CreateInstance(HELPER_CLASS_ID, Class_ID(POINTHELP_CLASS_ID, 0));
for(int i = 0; i < 8; i++){
SplineKnot u = t->GetKnot(i);
INode *HelpNode = ip->CreateObjectNode(newPoint);
Matrix3 tm;
tm.SetTranslate(u.Knot());
HelpNode->SetNodeTM(TimeValue(0), tm);
}
2 Replies
Jul 20, 2015 12:43 pm
of course knot position returned with (GetKnot(i)).Knot() is in object coordinate system.
to get it in world you have to multiply it by ObjectTM