# Physics Contraints Help

This topic is 2761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites

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.

##### Share on other sites
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:

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

##### Share on other sites
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.

Giliam

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633700
• Total Posts
3013428
×