Physics Contraints Help

Started by
2 comments, last by gdecarp 12 years, 11 months ago
Hello, I am trying to find material that can help me learn how to create a physics engine that uses constraints rather than impulses to resolve collision. I have already done the "Orange Book" physics engine and was looking for something like it that can explain constraints to me. Thank you
Advertisement

Hello, I am trying to find material that can help me learn how to create a physics engine that uses constraints rather than impulses to resolve collision. I have already done the "Orange Book" physics engine and was looking for something like it that can explain constraints to me. Thank you


Constraints and impulses are orthogonal things... Are you looking for advice on an engine which solves constraints on a force/acceleration level?

Cheers, Paul.
I assume you are familiar with the Euler-Newton equations http://en.wikipedia....Euler_equations

Let's assume particles for a moment. So you have:
dx/dt = v
dv/dt = F / m

The equation basically says that the acceleration of the particle equals the sum of all applied forces divided by the mass. These forces are usually functions of the position and/or velocity. See for example the harmonic oscillator http://en.wikipedia....onic_oscillator

So when you know the forces you usually end up with a differential equation whose solution gives you the position and velocity of the system as a function of time. The problem is that you often don't know all forces, but you additionally describe the system with geometric relations. E.g. you require that two particles are always some distance apart or that one point on rigid body A should always be coincident with another point on body b. These geometric relations are called constraints. For completeness note there can be also constraints on the velocity like e.g. for motors and friction, but this is not so important in the beginning

So for a simple pendulum you might have something like this:

dx/dt = v
dv/dt = F / m
C(x) = abs(x) - r = 0

This is not a differential equation (ODE) anymore, but a coupled system of algebraic and differential equations called differential-algebraic equation (DAE) which is usually a little harder so solve. So if you want to learn about this I recommend looking at the following texts. Actually I cannot recommend the Orange Book you mentioned.

Read everything from Erin Catto here:
http://code.google.c.../downloads/list

Study the university course by K. Bodin and C. Lacoussiere here:
http://www8.cs.umu.s...dv058sched.html

Finally if you want to get your hands dirty and write your own physics engine I recommend taking Box2D *Lite* and port it to 3D. I promise you will learn a lot from this!

Cheers,
-Dirk
Hi Chrispytoast,

A couple of years ago, I wanted to know more about physics constraint myself, and dove into the publicly available Doom 3 code to see what was going on there. Afterwards, I wrote an article about physics constraints for this engine (and possibly others). It's more about defining (new) constraint types, and understanding how they're being solved by id's solver, and not so much about writing a constraint solver yourself, If you're interested in reading it, have a look at http://www.decarpentier.nl/armed-mine.

Good luck with your project!

Giliam
www.decarpentier.nl - developer blog | @decarpentier_nl - twitter

This topic is closed to new replies.

Advertisement