Rigid body motion and game physics

  • #1

Main Question or Discussion Point

I am just playing around with physics simulation in c++... and my latest obsession is simulating rigid body motion (specifically rotation) with no external torque, for now. The equations of motion in question are the 'Euler equations' which relate the angular acceleration (omega-dot) around any principal axis to the angular velocity around the other two principal axes and the moments of inertia about all three:

http://en.wikipedia.org/wiki/Euler's_equations

So it's a system of coupled differential equations. My question is... does anyone know how to solve a system like this numerically without using some black-box function like NDSolve in Mathematica (I need to be able to implement it in c++)?

Or, if not, does anyone know the method used to solve problems of this kind in video game physics? I suspect that some kind of approximation is used in most cases. My eventual ambition is to write a simple flight simulator, so I don't need extreme accuracy- just the illusion of reality.

I did some quick searches but I couldn't find anything. I would really appreciate it if anyone can shed some light on this.
 

Answers and Replies

  • #2
172
0
In a video game scenario the solution is generally to resolve camera angles from the perspective of the player. As a result (having done this programming from time to time) is to position all the objects in the universe and then clip for what is in front of the "camera" / player and then rotate and translate for the current frame. Update the player (camera) point of view in the universe and then iterate through the cycle again.
 
  • #3
In a video game scenario the solution is generally to resolve camera angles from the perspective of the player. As a result (having done this programming from time to time) is to position all the objects in the universe and then clip for what is in front of the "camera" / player and then rotate and translate for the current frame. Update the player (camera) point of view in the universe and then iterate through the cycle again.
I'm not really worried about how I will eventually implement the camera view... my concept of it right now is to simply attach the camera to a physics object that is translating/rotating through the world's coordinate system (or anywhere else). I've done this in the past and probably would do it the same way again since it allows more flexibility in placing the camera.

I'm more worried about actually computing how the object is rotating, in this case as a result of torques caused by airflow over the various lifting and control surfaces. The problem comes when a rigid body is rotating in 3-D, because rotation about two of its principal axes is stable and the other is not (you can test this by tossing a book in the air), and there is complex interplay (described by the Euler equations) between the angular velocities about each principal axis.

At least, that's the way I understand it. Obviously if I was an expert, I would have figured this out by now. I don't think this behavior necessarily has to be modeled in-depth for a game (if your plane is spinning fast enough to notice these effects, you might be screwed) but I'm interested in how 'the pros' actually deal with it.
 
  • #4
111
2
I'm more worried about actually computing how the object is rotating..... I'm interested in how 'the pros' actually deal with it.
I am not a pro but I know that some of the pros use geometric algebra, which is well-tailored to this type of problem. An excellent source is "Geometric Algebra for Computer Science" by
Dorst, Fontijne, and Mann (Morgan Kaufmann series in computer graphics, 2007). Chapter 13 (The conformal model: operational Euclidean geometry) explains the basic methods,
including an exercise on interpolation of rigid body motions: translation and rotation are represented as exponentials of bivectors, allowing easy interpolation. For more information:

http://www.geometricalgebra.net/ [Broken]

http://www.science.uva.nl/ga/ [Broken]
 
Last edited by a moderator:

Related Threads on Rigid body motion and game physics

  • Last Post
Replies
21
Views
4K
Replies
13
Views
828
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
1
Views
25K
  • Last Post
Replies
4
Views
2K
Replies
8
Views
218
Replies
5
Views
2K
  • Last Post
Replies
1
Views
306
Replies
4
Views
742
Replies
2
Views
752
Top