Archived

This topic is now archived and is closed to further replies.

off-center pivot points?

This topic is 5778 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
of course u can rotate around any point u want. Why wouldnt u be able to? this question confuses me.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Anozireth
[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.

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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites