Simulating Rigid Body Physics

16.09.2022

Last edited 18.09.2022

• 01 Bodies that does not deform on contact. A completely rigid body doesn't exist in real life since all bodies break under high enough pressure. For the purpose of simulation we assume they are unbreakable.
• 02 Each invididual body has it's own virtual origin (0, 0) in which vertices are placed relative to. This is called local space. Moving/rotating the object doesn't affect it.
• 03 The space in which all bodies get placed in when drawing is called global space (or world space).
• 04 Note that as a workaround, a concave shape can be represented with a bunch of convex polygons.
• 05 A normal/orthogonal/perpendicular vector is a vector which forms a 90 degree angle (clockwise or counter-clockwise according to convention) with another vector.
• 06 Normalizing a vector just means dividing by its length. The resulting vector has length exactly 1 ($x^2 + y^2 = 1$).
• 07 I hope you can see how complicated you can create your engine: you can add support for mapping a non-uniform density, or you can create joints between bodies with different densities to create a large body that approximates your real-life example. However, our aim is not to create the perfect most general physics engine (because that can easily require an ungodly amount of work).
• 08 center of mass
• 09 divide a polygon up into smaller triangles
• 10 length of a vector
• 11 The vector with the least magnitude that is required to separate two overlapping shapes.
• 12 I actually really want to extend the demos and this article with an implementation, so stay tuned!
01
ALPHA BETA