Skip to content

Movement Equations

Björn Aheimer edited this page Oct 23, 2024 · 5 revisions

Our physics engine is based on impulses and momentum as proposed by Baraff. Since our game is two-dimensional, we are able to reduce his movement equations and receive the following system of partial differential equations:

$$ \frac{\textbf{d}}{\textbf{d}{t}} \left( \begin{array}{c} \vec{x}(t)\ \vec{P}(t)\ \theta(t)\ L(t) \end{array} \right)

\left( \begin{array}{c} {\vec{P}(t)}/{m}\ \vec{F}(t)\ L(t)/I\ \tau(t) \end{array} \right) $$

We devise a simple, yet effective symplectic Euler solver for this equation:

$$ \vec{P}^{t+1} &= \vec{P}^{t} + \delta t \cdot F^{t}\\ \vec{x}^{t+1} &= \vec{x}^{t} + \delta t \cdot \frac{P^{t+1}}{m}\\ L^{t+1} &= L^{t} + \delta t \cdot \tau^{t}\\ \theta^{t+1} &= \theta^{t} + \delta t \cdot \frac{L^{t+1}}{I} $$

Here, the force $\vec{F}^{t}$ and the torque $\tau^{t}$ are to be read as the sum of all forces or torques applied to a polygon at time step $t$. A body force only changes the polygon's linear momentum. In contrast, a surface force $\vec{F}$ applied at a point $\vec{p}$ changes linear and angular momentum. It generates a torque $$ \tau = (\vec{p} - \vec{x}) \times \vec{F}\label{eq:forceToTorque} $$ Disregarding collisions, only the gravitational force is considered in our simulation. It is applied as a body force.

Clone this wiki locally