🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Dealing with Non Center of Mass Translations

Started by
2 comments, last by too_many_stars 6 years, 3 months ago

Hello Everyone, 

It's very common in 2D and 3D to use the center of mass ( COM ) as the point of rotation. This method additionally make it easy to fit the model into a bounding sphere, AABB, capsule whatever. This is what I have always done. 

However, now I am trying to model a 3D hinged door. This door, due to the nature of rotation, will not be centered at the COM, instead, it will have to be translated locally either to the left or right depending on where the hinge should be. 

My question is...

What is the best way of dealing with Non-COM rotations?

The problem is, once the symmetry is gone from Non-COM model my bounding volumes are thrown off as they rely on COM. And obviously now when I am transforming from local to world co-ords it becomes harder to gauge where the object will be and how it will fit into the rest of the world. 

Also, I have to introduce some new variables such as glm::vec3 local_position to keep track of the new object center. It makes everything a lot messier. 

 

Thanks again for all the help, 

 

Mike

 

Advertisement

Rotating something about an axis other than the center of mass can be computed by transforming the inertia at center of mass (COM) to the new location using the Parallel Axis Theorem (PAT). PAT can transform only to the COM, or away from the COM. It cannot be used to transform from an off-COM axis to another off-COM axis (but it is possible to transform to COM, then back out to the new position).

https://en.wikipedia.org/wiki/Parallel_axis_theorem

In the link look for the final equation under Tensor Generalization. There is a nice formula that can be coded using vector/matrix ops and the outer product.

Thanks so much again for the help Randy, I will do as you suggest and try to make some sense out of it.

 

Mike

This topic is closed to new replies.

Advertisement