Integration is used to determine the motion of an object over time. In this article I show how to correctly integrate the equations of motion using an RK4 integrator instead of starting off on the wrong foot with a stupid Euler integrator.

Even an RK4 integrator is sensitive to the amount of time you step when integrating. Decouple your physics timestep from the display framerate so that your simulation behaves exactly the same way each time it is run.

Leap ahead from integrating single values to integrating the entire physics state for a cube in three dimensions. Introduces rotational physics concepts including orientation in 3D, angular velocity and momentum, inertia and torque.

Explains the physics of springs and how to apply them to control physics simulations. Learn how to implement joints, constraints, motors and basic collision response.

How do network games synchronize physics over the network? This article explains the core techniques used in today’s first person shooters and shows how you can apply these techniques to network your own physics simulations.

This articles are insightful. Very recommended.

These articles have been extremely helpful. Thank you very much!

Hello Glenn,

Greetings on that series of articles.

Any idea how to integrate Coulomb contact friction in

particle – mesh or particle – particle interaction?

hey mikhail, i don’t know how to do that yet – sorry!

Great articles. Really helped me out. I find that alot of the documentation for this kind of material is generally written in a style suited to mathematicians which I find difficult to interpret. Thanks!

Ill second that – favourited!

yeah you and me both, its like they actively try to make it hard to read

Hey glenn I was wondering, do you know a lot of calculus ? Do you study daily ? I’ve seen most people pick the formulas and general algorithms to make their physics but they usually don’t know what exactly the formulas mean.

i’m a self taught programmer, i have no degree but i’ve gone to a few university courses to brush up on some more mathematics – and i did advanced math in highschool, so i have decent background, but really *nothing* on somebody who went through actual physics or electrical engineering maths

in otherwords, i have “programmer mathematics”, meaning i learn what i need to do what i want to do, and not much more

so i don’t do calculus daily, just when i need it. and usually, it’s very VERY slow

but a key thing is that i always try to understand, as deep as i can what i am working on… so I do know the taylor’s theorem basis for RK4 and understand it, and i can derive it if necessary. the only thing i’m a bit fuzzy on in the whole physics articles is how to calculate the spin quaternion to integrate the orientation from angular velocity. i don’t fully understand the mathematics behind that, but the rest i’m pretty solid on.

if you want to study something to get a deeper meaning of the physics equations, i highly recommend taking a look at baraff’s siggraph courses on physics simulation (google for it) – this is a good place to get a good understanding of the mathematics and ideas behind physics simulation

in fact really, you could just look at my articles as a poor man’s version of his papers, covering much the same material, but with a programmer focus instead of a mathematics focus

cheers

Hi Glen. I am loving the articles you’ve written so far. They’re very informative and have given me some great ideas for building my own physics engine. I was wondering if you have any plans to write an article about collision detection (or if you’ve already written one).

Thanks again!

Hello James, well I was going to write one about collision detection, but then I found out about “Real Time Collision Detection” by Christer Ericson. This is *the* book you want to get. Any article I would write would just be inferior to this.

cheers mate

Thanks Glenn, It looks pretty good. I’ll give it a read,

James

On the spring physics page there’s a link tag around the text “next article” but it’s not linked to anything.

it is fixed, thank you!

Thanks for being so generous with the source code AND dynamics simulation explanations. I’ve tried using your example code to model a real dynamic system and run into the dreaded divergence ‘explosion’. Even though the dynamics are ‘low’ and the 100hz timestep should be plenty small enough (I think), it’s not easy sorting out the cause.. Any suggestions for diagnosing this general type of problem? Is there a general series of diagnostic steps that you’d recommend for resolving divergence? (I started by cutting the timestep down by a factor of 10 but it just pushed the divergence further out in time). Since everything is done as a float is there a potential for things to become denormalized/inconsistent that requires frequent action?

I really cannot comment without knowing more details about your simulation, what exactly are you trying to do?

I’m trying to simulate simple drifting of an object in a water flow. So, I start with a stationary object and expect it to speed up and reach steady state at the same speed as the current. It seems to do this but after reaching steady state, an oscillation develops that eventually diverges. I noticed that after a couple uses of coordinate transformations using quaternions, some of the x,y forces bleed into the z axis (which is a no-no for my 3dof sim). Do I need to normalize occasionally or take some action to prevent angular momentum from being developed somehow? The cube demo seems to have an angular velocity damping term added to prevent this from being a problem.. is it necessary because of precision issues with the implementation? Thanks for the discussion.

it is generally necessary to renormalize the quaternion after you integrate it, provided that it is a certain distance from length 1.0, this may help.

Wanted to thank you for these wonderful tutorials, A mind is a powerful tool, knowledge is power!

Hey glen!

Thanks for these wonderful articles they have helped me so much!

I was wondering If you had written any articles about loading/rendering 3d models, or if you know of any good books about this as I haven’t found any that seem to be good,

thanks!

unfortunately, no. just articles on physics and networking. try wolfgang engel’s shader X series

it’s awesome,you are a cool man!!!!!!!!!

this helped me with my science fair project, thanks

Hi Glenn,

Your articles have been of great help for my thesis demo. I was wondering if you have written or have plans to write a book on Game development and/or physics. Thanks again.

I’m much more likely to write a book on game networking, i’m much better at that! cheers

Hi, I find your tutorials probably the easiest to follow. You pretty much answer every question i have except collision response.

Thanks! Try my new “Virtual Go” tutorials. They cover collision response

i am chinese, and my english is very poor , but i am trying to read your article , very good