Rotating at the same position?

Hi,

I am having problem with setting Pivot for my rotation.

So, I’ve put ofPushMatrics() and ofPopMatrics() to give an additional transformation and the rotations’s pivot is getting from somewhere really far.

How would I set the pivot with a target object? (like target object’s centroid as pivot)

You can set a transform to the centroid, then do a rotate around the axis you want to rotate around.

ofPushMatrics();
ofTranslate(x, y, z);  //Centroid
ofRotateX(15); // Rotate around the x axis 15 degrees
// Draw here
ofPopMatrics();

Is that what you meant by pivoting around the center of the object?

I tried that, maybe it is because I am having 2 matrices nested?
I want to set centroid to be a targetted object’s center.

Can you post some of your code? It’s difficult to help beyond what I have already posted.