What is inertia in a physics engine? - Game Development Stack Exchange most recent 30 from gamedev.stackexchange.com 2019-12-07T06:17:02Z https://gamedev.stackexchange.com/feeds/question/141536 https://creativecommons.org/licenses/by-sa/4.0/rdf https://gamedev.stackexchange.com/q/141536 3 What is inertia in a physics engine? Winter https://gamedev.stackexchange.com/users/90003 2017-05-24T13:38:33Z 2018-12-24T04:09:59Z <p>Inertia seems to be useful in a physics engine, so useful that even in Box2DLite, a demo of Box2D it hasn't been omitted.</p> <p>See this Body class from Box2DLite:</p> <pre><code>struct Body { Body(); void Set(const Vec2&amp; w, float m); void AddForce(const Vec2&amp; f) { force += f; } Vec2 position; float rotation; Vec2 velocity; float angularVelocity; Vec2 force; float torque; Vec2 width; float friction; float mass, invMass; float I, invI; //inertia and reverse inertia }; </code></pre> <p>In the implementation of the class, inertia is set as the mass multipled by something:</p> <pre><code>I = mass * (width.x * width.x + width.y * width.y) / 12.0f; invI = 1.0f / I; </code></pre> <p>What does this formula means ? I understood from <a href="https://en.wikipedia.org/wiki/Inertia" rel="nofollow noreferrer">wikipedia</a> that Inertia is how much something doesn't want to move but there's not much formulas in this article. Why is it useful in a physics engine ? How is it used in the context of a collision ? Is it compared to other bodies ?</p> https://gamedev.stackexchange.com/questions/141536/-/141540#141540 4 Answer by Louis Langholtz for What is inertia in a physics engine? Louis Langholtz https://gamedev.stackexchange.com/users/98346 2017-05-24T14:28:31Z 2018-12-24T04:09:59Z <p>I believe what we're looking at here more specifically refers to <strong>rotational</strong> inertia and inverse <strong>rotational</strong> inertia; not to linear inertia (nor inverse linear inertia).</p> <p>Wikipedia explains that <strong>rotational inertia</strong> is <em>also known as</em> the <strong>moment of inertia</strong>. From here you can take a look at <a href="https://en.wikipedia.org/wiki/List_of_moments_of_inertia" rel="nofollow noreferrer">Wikipedia's List of Moment of Inertia</a> where the constant integer 12, shows up in a few of the formulas like for the rotational inertia of rectangular plate about its center.</p> <p><strong>Rotational inertia</strong> is useful in the context of simulating a collision in providing a measure to which the object should resist rotation in collisions that have a tangential component. In other words, it provides a measure of how much rotational velocity should be changed due to collisions that can be thought of as bumping up and rubbing against another body.</p> https://gamedev.stackexchange.com/questions/141536/-/141603#141603 0 Answer by Ian Young for What is inertia in a physics engine? Ian Young https://gamedev.stackexchange.com/users/48612 2017-05-25T17:30:16Z 2017-05-25T17:30:16Z <p>Inertia is a body's resistance to changes in angular velocity(rotational speed).</p> <p>Inertia, in game engines is usually fudged a little, but is represented as a 3x3 matrix transform.</p> <p>that transform is used to change an angular impulse (final angular deltaV = inertia * deltaV). In the case I just outlined, this is actually the inverse inertia transform, or inertia^-1</p> <p>When you do this it is the same as dividing a linear impulse by the mass of the body.</p> <p>In your case, using the contact point, you compute the torque (force to induce change in velocity around an axis), and transform it with the inverse inertia, which produces the final change in angular velocity.</p>