Notifications
Clear all

[Closed] pivot problems in the sdk

I thought I might if had this working. But no -sigh

It looks to me moving my pivot sometimes if the object is not scaled. Then its a mess.

I’m I doing this right?


 Box3 bb;
 ViewExp& vpt = ip->GetViewExp(NULL);
 for( auto i = 0; i < ip->GetSelNodeCount(); i++){
    INode *newnode = ip->GetSelNode(i);
   Object *obj = newnode->GetObjectRef();
   obj->GetLocalBoundBox(ip->GetTime(), newnode, vpt.ToPointer(), bb);
   Point3 theBox(bb.pmin.x, bb.Center().y, bb.Center().z );
   Matrix3 mat(1);
   newnode->ResetPivot(ip->GetTime());
   newnode->Move(ip->GetTime(), mat, theBox, TRUE, FALSE, PIV_PIVOT_ONLY, FALSE);
   newnode = NULL;
}
ip->RedrawViews(ip->GetTime());
 

I guess what I’m after is the c++ way to …
obj.pivot = [obj.min.x, obj.center.y, obj.center.z]

thanks for any thoughts on this

5 Replies

is this where I should be looking?

IWorkingPivot.h

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

this is different…

you should use INode::Move with flag PIV_PIVOT_ONLY

Ok, good to know.

The problem I have is if the object is in great shape it works fine. But if the object has been scaled, it moves the object far of the screen.

From the above code Am I missing something?

bounding box is local, transform matrix is in world coordinate system. you have to pick one but the same axis system.

ahhh, so I should have used GetWorldBoundBox