off-center pivot points?

Started by
6 comments, last by racer_x 22 years, 2 months ago
Hey everybody! I want to rotate an object around a pivot point that is not in it''s center of mass. Is there a simple way to do this? Are there different ways to do it? Thanks! Everyone who answers this post will be my hero :^) -E
Advertisement
Hmm... this is just a theoretical thing, dunno if it would work:

You could define each vertex as a vector, with the rotation point being the origin. Then rotate the vectors to rotate the model. So, to rotate around something other than center of mass, just define a different origin for that rotation.

But yeah, I really have no idea if it would work...
WNDCLASSEX Reality;......Reality.lpfnWndProc=ComputerGames;......RegisterClassEx(&Reality);Unable to register Reality...what's wrong?---------Dan Uptonhttp://0to1.orghttp://www20.brinkster.com/draqza
of course u can rotate around any point u want. Why wouldnt u be able to? this question confuses me.
Okay, maybe it''s an obvious thing I just don''t see. Here is the entire scoop:

I have a cannon like in scorched earth. I want the barrel to be able to tilt from a point that is not it''s (the barrel''s) center of mass, but I want the base to stay still. I''m working on a hierarchy for each seperate object, but let''s pretend it works. How do I tilt the barrel up and down around the off-center axis while keeping the barrel "in place"?

-E
There are probably better ways to do it but you could always add the offset from the center to the point you want to rotate about to each point,rotate, and then subtract the offset. It rotates around whatever is the objects (0,0,0) is right? so if you want to rotate about object''s(1,3,5) you make (1,3,5) the same as (0,0,0) by adding(-1,-3,-5) to each vertex...
quote:Original post by Anonymous Poster
of course u can rotate around any point u want. Why wouldnt u be able to? this question confuses me.


that is the dumbest response I have ever seen to any post ever. period.
quote:Original post by Anozireth
Original post by Anonymous Poster
of course u can rotate around any point u want. Why wouldnt u be able to? this question confuses me.


that is the dumbest response I have ever seen to any post ever. period.

sorry maybe i seemed a little mean or something im just tired. All i was trying to do was get a little more information about his problem which he gave in the next post so it all worked out in the end.

ps There are to many flaming wars on these forums so lets not start another one
Yes, basically just do a glTranslate to get your pivot to be equal to 0,0,0 then rotate then "undo" your translate.

To rotate aboute the point(1,2,3) translate(-1,-2,-3), rotate, then translate(1,2,3). There''s probably some way to create the perfect matrix to do this very thing, but I wouldn''t bother...

This topic is closed to new replies.

Advertisement