taskWarmux - Tasks: task #4159, Use an external Physical Engine

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

task #4159: Use an external Physical Engine

Submitted by:  Yannig <drayan>
Submitted on:  Wed Nov 22 22:12:31 2006  
Should Start On: Wed Nov 22 00:00:00 2006Should be Finished on: Wed Nov 22 00:00:00 2006
Category: physical enginePriority: 1 - Later
Status: In ProgressPercent Complete: 80%
Assigned to: Lawrence Azzoug <lami01>Open/Closed: Open

(Jump to the original submission Jump to the original submission)

Sat Sep 13 00:09:42 2008, comment #20:

A functionnal terrain generation is implemented. Look at the modified screenshoot to see where the collisions polygone are.

(file #4792)

Frédéric Bertolus <fredb219>
Project Administrator
Sun Sep 7 19:51:00 2008, comment #19:

fredb219 and me have begun to integrate Box2D into Wormux.

Currently, I can't see how to manage collision with the ground!!

"The maximum vertex count is defined by b2_maxPolyVertices which is currently 8" so it's impossible to make the ground acts as one single polygon...

I have read several topics about that in Box2d forum but I'm not convinced by any solution...

Anyway, this one is interested

Matthieu Fertré <gentildemon>
Project Administrator
Wed Nov 14 11:13:53 2007, comment #18:

Well, I have finaly managed to make things works with cmake.

So basicaly get the tar.gz, untar, go to Box2D-v1.4.2-cmake/Box2D, then run 'cmake .' then make clean, make and launch ./Examples/framework.

You will obtain a very good example of what this library is capable of ...

One word, amazing ! Thanks Erin Catto for this great piece of software !

(file #3202)

Yannig <drayan>
Project Administrator
Tue Nov 13 10:01:15 2007, comment #17:

A good example of 2D physical engine :

Box2D :

Very interesting project but no way to compile it with autotools or cmake just VC8 files ...

I'm currently trying to compile it using cmake but actually, it's not working. I have managed to compile the library but no way to link the demo.

So if a cmake guru is interested ...

And Phys2D :

Written in Java ! try out the demo, it's quite amazing !

Yannig <drayan>
Project Administrator
Fri Sep 14 12:18:32 2007, comment #16:

Good notes for GJK explanation :


Yannig <drayan>
Project Administrator
Thu Sep 13 09:04:06 2007, comment #15:

Very interesting presentation about the GJK algorithm :


GJK is used to compute the distance between two polygon.

Yannig <drayan>
Project Administrator
Wed Sep 12 13:04:00 2007, comment #14:


CARRE <yekcim>
Project Administrator
Thu Aug 9 18:44:51 2007, comment #13:

v 0.2.1

What's new :
- Better stability of stacked object (but still not perfect)
- Higher performance (remove the need of triangle test).

(file #2772)

Yannig <drayan>
Project Administrator
Wed Aug 8 08:09:34 2007, comment #12:

Before continuing, I want to finish a basic set of things which include :
- air resistance / water
- explosion
- event handling.
- proper overlapping of stacked object.
- document this things to be sure every one can understand how it basicaly work I to avoid futur misunderstanding.

Also, I think it could be a good thing to make this engine as independant as possible. Maybe make this engine as a library for Wormux. Who knows, maybe somebody can be interested about this thing.

Yannig <drayan>
Project Administrator
Tue Aug 7 23:11:05 2007, comment #11:

First some comments about building:
- need to install libtool
- an error : g++ -g -O2 -o physics -R/usr/lib physics.o color.o constraint.o link.o object_generator.o particle.o physical_engine.o physical_polygon.o affine_transform.o error.o random.o -L/usr/lib -lSDL -lSDL_image -lSDL_gfx -lSDL_image -lpng12
g++: unrecognized option '-R/usr/lib'

to fix, remove the unrecognized option ;-) :
cd src/
g++ -g -O2 -o physics physics.o color.o constraint.o link.o object_generator.o particle.o physical_engine.o physical_polygon.o affine_transform.o error.o random.o -L/usr/lib -lSDL -lSDL_image -lSDL_gfx -lSDL_image -lpng12


Wouw! it's amazing!!! Good work Drayan!
Will it be difficult to integrate into Wormux ?

Matthieu Fertré <gentildemon>
Project Administrator
Tue Aug 7 21:56:30 2007, comment #10:

Work work !

Now the engine is capable of handling stacked object.

It's not perfect but it's became more and more usable :)


(file #2764)

Yannig <drayan>
Project Administrator
Mon Aug 6 13:34:54 2007, comment #9:

Todo : push this function in vector2.h :
static Vector2<T> Intersection(const Vector2<T> & A, const Vector2<T> & B, const Vector2<T> & C, const Vector2<T> & D) {
double a1, a2, b1, b2, xr, yr;
/*// No intersection possible => compute a fake cross point which is a avg of this four point
if(A.x == B.x && C.x == D.x) {
double x1, y1, x2, y2;
x1 = (C.x - A.x) + A.x;
y1 = (C.y - A.y) + A.y;
x2 = (B.x - D.x) + B.x;
y2 = (B.y - D.y) + B.y;
return Vector2<T>(static_cast<T>((x1 + x2) / 2), static_cast<T>((y1 + y2) / 2));
} else if(A.x == B.x) {
a2 = (C.y - D.y) / (C.x - D.x);
b2 = C.y - a2 * C.x;
return Vector2<T>(static_cast<T>(A.x), static_cast<T>(a2 * A.x + b2));
} else if(C.x == D.x) {
a1 = (C.y - D.y) / (C.x - D.x);
b1 = C.y - a2 * C.x;
return Vector2<T>(static_cast<T>(C.x), static_cast<T>(a1 * A.x + b1));
// Youhouh ! A normal situation :)*/
a1 = (A.y - B.y) / (A.x - B.x);
a2 = (C.y - D.y) / (C.x - D.x);
b1 = A.y - a1 * A.x;
b2 = C.y - a2 * C.x;
xr = (b2 - b1) / (a1 - a2);
yr = a1 * xr + b1;
return Vector2<T>(static_cast<T>(xr), static_cast<T>(yr));

Compute the cross point of 2 lines (A, B) and (C, D).

Yannig <drayan>
Project Administrator
Sun Aug 5 21:10:43 2007, comment #8:

A new tar of the little project as I'm not very happy to keep this kind of work on my local machine.

So here a new version with a very basic version of the overlapping constraint. To be honest, it's a bit jerky :)

But as a noticeable news, we have now a working rope and a rubber band :)

As usual, take the tar and do the classical imprecation (configure ; make ; make install).

The last thing which need to be done is to enhance the collision algorithme :)



(file #2757)

Yannig <drayan>
Project Administrator
Sat Aug 4 14:02:44 2007, comment #7:

And here is a new enhanced and clean up version with fully working autotools.

Take the tar physics-0.1.1.tar.bz2 in the bottom of the page then :

tar xfvj physics-0.1.1.tar.bz2
cd physics

then go in the src directory, run the little program and enjoy it.

cd src

What is working now :
- ground collision detection.
- wind handling
- gravity
- overlaping detection (but nothing to handle this for the moment)

What need to be done :
- constraints no overlaping shape
- enhance the way we detect overlaping because it's damn slow !

(file #2753)

Yannig <drayan>
Project Administrator
Fri Aug 3 23:46:27 2007, comment #6:

Reorganization in the source code and more important, the colision detection is working (it's quite simple in fact).

Now I need to find a method to make them rebound when they overlapse something.

I have updated the demo, now, the gravity is spining around. So object (a circle, a triangle and a cube) are bouncing around like in washing machine :) with still a rope fixed in the air and bouncing particle all around.

Have fun !

(file #2751)

Yannig <drayan>
Project Administrator
Fri Aug 3 10:52:53 2007, comment #5:

Interesting paper about physic simulation grab around the net.

Wikipedia reference about collision detection :

Minkowski's addition :

much more funny java applet demonstrating Minkowski's addition :

Gilbert-Johnson-Keerthi distance algorithm :

Paper about the nofit polygon algo :

What's remain is the need of a colision detection algorithm. A simple way to do it is to sort out every triangle of the polygon by a basic bound test and then to compute a Minkowski's sum for the remaining triangle. If one of the two triangle is fully in the Minkowski polygon, then both triangle overlapse.

Yannig <drayan>
Project Administrator
Thu Aug 2 20:54:14 2007, comment #4:

Here is a little project with the aim to test a new physical engine. Actually, things are quite simple but the result is very interesting. Just a little precision : I have wrote this up in ~ 4-5 hours.

The archive contain the source code (GPL code) with autotools, a binary debug version (compiled under an ubuntu feisty) and a kdevelop project if you want to open it under kdevelop.

If you want to launch it, grab the binary in physics/debug/src/physics. If you want to compile it, you need to install SDL and SDL_gfx.

Well, good night people !

Yannig (aka Drayan).

(file #2740, file #2741)

Yannig <drayan>
Project Administrator
Mon Jul 9 09:04:44 2007, comment #3:

A very interesting article about physic simulation :

The author talk about the physical engine used in Hitman: Codename 47.

This engine use the Verlet integration (http://en.wikipedia.org/wiki/Verlet_integration).

Yannig <drayan>
Project Administrator
Sat May 19 07:18:40 2007, comment #2:

pygame seems to contain a physic engine as well

Laurent Defert <lodesi>
Project Administrator
Fri Mar 16 09:57:02 2007, comment #1:

Another cool little project of physical engine :


Yannig <drayan>
Project Administrator
Wed Nov 22 22:12:31 2006, original submission:

ODE (Open Dynamic Engine) is a library which have in main aim to create a physical engine.

As you expect, ODE is using 3D world but after a quick look in the Wiki, an example introduce you how to use it in a 2D world !

Here's the article : http://opende.sourceforge.net/wiki/index.php/HOWTO_constrain_objects_to_2d

The question is we can continue to improve our internal beloved physical engine and if we continue to hunt bug or if we take an already existing one and rely on it.

I think, this physical engine can resolve many of our current problem like ninja rope management, water resistance, gravity etc. I know, our internal physical engine did already a good job (except for ninja rope) but I think ODE exceed by far every need we can imagine.

Some reference :

ODE manual : http://opende.sourceforge.net/wiki/index.php/Manual

ODE License (GPL or BSD) : http://opende.sourceforge.net/wiki/index.php/Manual#ODE.27s_License

An ODE presentation : http://www.ode.org/slides/igc02/index.html

ODE reference (impressive !) : http://www.ode.org/users.html

Yannig <drayan>
Project Administrator


Attached Files
file #4792:  physical_terrain.png added by fredb219 (2kB - image/png)
file #3202:  Box2D-v1.4.2-cmake.tar.gz added by drayan (111kB - application/x-tgz)
file #2772:  physics-0.2.1.tar.gz added by drayan (346kB - application/x-tgz)
file #2764:  physics-0.2.0.tar.gz added by drayan (346kB - application/x-tgz)
file #2757:  physics-0.1.9.tar.bz2 added by drayan (293kB - application/x-tbz)
file #2753:  physics-0.1.1.tar.bz2 added by drayan (238kB - application/x-tbz)
file #2751:  physics-0.1.tar.gz added by drayan (272kB - application/x-tgz)
file #2742:  physics.tar.gz added by drayan (316kB - application/x-tgz)
file #2740:  physics added by drayan (554kB - application/x-executable)
file #2741:  physical_engine.png added by drayan (3kB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by fredb219 (Updated the item)
  • -unavailable- added by yekcim (Posted a comment)
  • -unavailable- added by gentildemon (Posted a comment)
  • -unavailable- added by lodesi (Posted a comment)
  • -unavailable- added by drayan (Submitted the item)

    Error: not logged in



    Follow 18 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Nov 18 18:45:51 2010yekcimAssigned tofredb219=>lami01
      SummaryUse a Bullet Physical Engine=>Use an external Physical Engine
    Sat Jul 25 11:30:20 2009yekcimAssigned todrayan=>fredb219
      SummaryUse a Physical Engine like ODE=>Use a Bullet Physical Engine
    Mon Dec 8 20:24:23 2008fredb219Percent Complete10%=>80%
    Sat Sep 13 00:09:42 2008fredb219Attached File-=>Added physical_terrain.png, #4792
      Percent Complete0%=>10%
    Wed Nov 14 11:13:53 2007drayanAttached File-=>Added Box2D-v1.4.2-cmake.tar.gz, #3202
    Wed Sep 12 13:04:00 2007yekcimStatusNone=>In Progress
    Thu Aug 9 18:44:51 2007drayanAttached File-=>Added physics-0.2.1.tar.gz, #2772
    Tue Aug 7 21:56:30 2007drayanAttached File-=>Added physics-0.2.0.tar.gz, #2764
    Sun Aug 5 21:10:43 2007drayanAttached File-=>Added physics-0.1.9.tar.bz2, #2757
    Sat Aug 4 14:02:44 2007drayanAttached File-=>Added physics-0.1.1.tar.bz2, #2753
    Fri Aug 3 23:46:27 2007drayanAttached File-=>Added physics-0.1.tar.gz, #2751
    Thu Aug 2 20:58:42 2007drayanAttached File-=>Added physics.tar.gz, #2742
    Thu Aug 2 20:54:14 2007drayanAttached File-=>Added physics, #2740
      Attached File-=>Added physical_engine.png, #2741
      Assigned toNone=>drayan
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup