- #1
Aggrav8d
- 2
- 0
inertia tensors (moment of inertia) for a game
Hello, physics gurus!
I'm trying to write a little 2D game that uses physics for more dynamism. Part of this game involves shapes bouncing around and reacting to forces, each other, etc. Each shape that can interact is a set of one or more closed concave line loops. (Complex line loops are not allowed.) Each set has an assigned mass and center. What I would like to do is develop an algorithm in C or C++ to calculate the inertia tensor for any of these shapes. I can decompose the shapes into a set of non-overlapping triangles, if that helps. I already have special cases for circles and rectangles who's centers are in the middle of the mass... but I would feel much better if I had a general solution. Sadly I failed my introductory level calculus class and I'm under a bit of a deadline.
If anyone of you miracle workers can help me I would be eternally grateful. Thank you in advance!
Hello, physics gurus!
I'm trying to write a little 2D game that uses physics for more dynamism. Part of this game involves shapes bouncing around and reacting to forces, each other, etc. Each shape that can interact is a set of one or more closed concave line loops. (Complex line loops are not allowed.) Each set has an assigned mass and center. What I would like to do is develop an algorithm in C or C++ to calculate the inertia tensor for any of these shapes. I can decompose the shapes into a set of non-overlapping triangles, if that helps. I already have special cases for circles and rectangles who's centers are in the middle of the mass... but I would feel much better if I had a general solution. Sadly I failed my introductory level calculus class and I'm under a bit of a deadline.
If anyone of you miracle workers can help me I would be eternally grateful. Thank you in advance!
Last edited: