Calculus In Physics Engines

What are Physics Engines?

Physics engines are programs that are used to simulate physical phenomena. These programs have been used for decades by the military, meteorologists, and even video game developers. Their applications range from determining where artillery shells would land, based on several parameters, to simulating a similar situation in a match of Call of Duty or Battlefield. Video games offer a great chance to see how simulations are run. Of course, physics simulations in video games are not solely limited to militaristic phenomena. In fact, the other applications are mostly artful in nature and can lead to downright breathtaking moments for consumers.

What does this have to do with Calculus?

The different applications for physics engines are as interesting as they are extensive, but what does this have to do with calculus and this course in general? As it happens, functions are an integral part of physics engines and programming. Initially the calculus of physics engines in video games was delegated to detecting collisions between in-game objects (such as player characters, rocks, and dust particles) and enacting appropriate responses. However, over the last few decades the engines have been updated to adopt more advanced calculus to the effect of more believable interactions between in-game objects. In order to apply the level of calculus necessary to achieve such effects, physics engines use a segment of code called an integrator. The integrator of a physics engine would take in information of an object at time t and apply that information to formulas in order to determine the new position/vector of said object.

Basic Integrator Formulas and other Determinants

Here are just some of the formulas used by a physics engine integrator:

Position

Derivative: $\mathit{r(t)}$

Integral: $\mathit{r(t)}$ = $r_0 + \int_0^t vdt’$

Velocity

Derivative: $\mathit{v(t)}$ = $\frac{dr}{dt}$

Integral: $\mathit{v(t)}$ = $v_0 + \int_0^t adt’$

Acceleration

Derivative: $\mathit{a(t)}$ = $\frac{dv}{dt} = \frac{d^2r}{dt^2}$

Integral: $\mathit{a(t)}$

This means that the Velocity of an object can be found with the anti derivative of its Acceleration and its Position with the anti derivative of its velocity. It also means that the area determined by the integral of the Acceleration is the total change in velocity, and the area determined by the integral of the Velocity is the displacement of the object. All of which are important for predicting the position of any object from the time a simulation starts to when it ends.

Aside from these important formulas that determine the position/vector of in-game objects, the objects are also subjected to the same laws of physics that we experience in reality. These laws include Isaac Newton’s laws of motion and universal law of gravity, and D’Alembert’s principle which sums all the vectors of an object into one whole vector.

ex. The total work done by a constant Force ($\mathit{F}$) whilst moving an object a distance($\mathit{d}$) is represented by the integral:

$\mathit{W}$ = $\int_a^b F(x)dx$

Although the simulations are not always perfect, the combination of all these factors working together within a physics engine provide an experience that is becoming more realistic every year to the point of being almost indistinguishable from physical phenomena we may see in everyday life. Calculus ultimately plays an important part in how such an engine interprets data from a simulation and returns an appropriate response. It can even be said that without calculus it would be impossible to predict the outcome of a physical phenomenon in a simulation or even in reality.

Sources

Applied Calculus 5th Edition (Hughes-Hallet, Gleason, Lock, Faith, et al.) : 5.1, 5.2

https://faculty.atu.edu/mfinan/2924/cal76.pdf

http://www.ugrad.math.ubc.ca/coursedoc/math103/site2012/keshet.notes/Chapter4.pdf

https://prezi.com/qicki_zqvo9v/the-calculus-of-video-games/

 

 

One comment

  1. kpy9950

    It is unbelievable how frequently calculus is used in our everyday activities. I have always been aware of the presence of calculus within the work of engineers however, I never recognized how often it is used. Thank you for sharing with me these formulas as it allows me to understand how calculus can be applied to very important parts of our lives.

Post a comment