Notifications
Clear all
[Closed] C++ ObjOffsetPos always at (0,0,0) ?
Jun 23, 2015 12:38 pm
Hi, I am trying to change the pivot point on my Node. But whenever I get the ObjOffSetPos, its always at (0, 0, 0). How do I change this so I am able to get the Pos of the Node. The Code I am using is below:
Box3 bb;
ViewExp& vpt = ip->GetViewExp(NULL);
for( auto i = 0; i < ip->GetSelNodeCount(); i++){
INode *newnode = ip->GetSelNode(i);
theObject.GetWorldBoundBox(ip->GetTime(), newnode, vpt.ToPointer(), bb);
Point3 theBoxMax(&bb.pmax[0]);
Point3 pt = newnode->GetObjOffsetPos();
Point3 newpt(pt.x + theBoxMax.x, pt.y + theBoxMax.y, pt.z + theBoxMax.z);
Matrix3 tm;
tm.SetTranslate(newpt);
newnode->SetNodeTM(TimeValue(0), tm);
newnode->SetObjOffsetPos(-theBoxMax);
newnode = NULL;
}