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 22 Nov 2006 10:12:31 PM UTC  
 
Should Start On: Wed 22 Nov 2006 12:00:00 AM UTCShould be Finished on: Wed 22 Nov 2006 12:00:00 AM UTC
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 13 Sep 2008 12:09:42 AM UTC, 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 07 Sep 2008 07:51:00 PM UTC, 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
http://www.box2d.org/forum/viewtopic.php?f=3&t=1180

Matthieu Fertré <gentildemon>
Project Administrator
Wed 14 Nov 2007 11:13:53 AM UTC, 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 13 Nov 2007 10:01:15 AM UTC, comment #17:

A good example of 2D physical engine :

Box2D :
http://www.box2d.org/

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 :
http://www.cokeandcode.com/phys2d/

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

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

Good notes for GJK explanation :

http://realtimecollisiondetection.net/pubs/SIGGRAPH04_Ericson_GJK_notes.pdf

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

Very interesting presentation about the GJK algorithm :

http://realtimecollisiondetection.net/pubs/SIGGRAPH04_Ericson_the_GJK_algorithm.ppt

GJK is used to compute the distance between two polygon.

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

https://gna.org/projects/whysics/

CARRE <yekcim>
Project Administrator
Thu 09 Aug 2007 06:44:51 PM UTC, 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 08 Aug 2007 08:09:34 AM UTC, 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 07 Aug 2007 11:11:05 PM UTC, 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

run:
./physics

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

Matthieu Fertré <gentildemon>
Project Administrator
Tue 07 Aug 2007 09:56:30 PM UTC, 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 :)

Drayan

(file #2764)

Yannig <drayan>
Project Administrator
Mon 06 Aug 2007 01:34:54 PM UTC, 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 05 Aug 2007 09:10:43 PM UTC, 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 :)

Regards,

Drayan

(file #2757)

Yannig <drayan>
Project Administrator
Sat 04 Aug 2007 02:02:44 PM UTC, 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
./autogen.sh
make

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

cd src
./physics

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 03 Aug 2007 11:46:27 PM UTC, 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 03 Aug 2007 10:52:53 AM UTC, comment #5:

Interesting paper about physic simulation grab around the net.

Wikipedia reference about collision detection :
http://en.wikipedia.org/wiki/Collision_detection

Minkowski's addition :
http://en.wikipedia.org/wiki/Minkowski_sum

much more funny java applet demonstrating Minkowski's addition :
http://www.cut-the-knot.org/Curriculum/Geometry/PolyAddition.shtml

Gilbert-Johnson-Keerthi distance algorithm :
http://en.wikipedia.org/wiki/Gilbert-Johnson-Keerthi_distance_algorithm

Paper about the nofit polygon algo :
http://www.asap.cs.nott.ac.uk/publications/pdf/gk_wmc99.pdf

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 02 Aug 2007 08:54:14 PM UTC, 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 09 Jul 2007 09:04:44 AM UTC, comment #3:

A very interesting article about physic simulation :
http://www.teknikus.dk/tj/gdc2001.htm

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 19 May 2007 07:18:40 AM UTC, comment #2:

pygame seems to contain a physic engine as well

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

Another cool little project of physical engine :

http://people.freedesktop.org/~krh/akamaru.git/

Yannig <drayan>
Project Administrator
Wed 22 Nov 2006 10:12:31 PM UTC, 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)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 18 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 18 Nov 2010 06:45:51 PM UTCyekcimAssigned tofredb219=>lami01
      SummaryUse a Bullet Physical Engine=>Use an external Physical Engine
    Sat 25 Jul 2009 11:30:20 AM UTCyekcimAssigned todrayan=>fredb219
      SummaryUse a Physical Engine like ODE=>Use a Bullet Physical Engine
    Mon 08 Dec 2008 08:24:23 PM UTCfredb219Percent Complete10%=>80%
    Sat 13 Sep 2008 12:09:42 AM UTCfredb219Attached File-=>Added physical_terrain.png, #4792
      Percent Complete0%=>10%
    Wed 14 Nov 2007 11:13:53 AM UTCdrayanAttached File-=>Added Box2D-v1.4.2-cmake.tar.gz, #3202
    Wed 12 Sep 2007 01:04:00 PM UTCyekcimStatusNone=>In Progress
    Thu 09 Aug 2007 06:44:51 PM UTCdrayanAttached File-=>Added physics-0.2.1.tar.gz, #2772
    Tue 07 Aug 2007 09:56:30 PM UTCdrayanAttached File-=>Added physics-0.2.0.tar.gz, #2764
    Sun 05 Aug 2007 09:10:43 PM UTCdrayanAttached File-=>Added physics-0.1.9.tar.bz2, #2757
    Sat 04 Aug 2007 02:02:44 PM UTCdrayanAttached File-=>Added physics-0.1.1.tar.bz2, #2753
    Fri 03 Aug 2007 11:46:27 PM UTCdrayanAttached File-=>Added physics-0.1.tar.gz, #2751
    Thu 02 Aug 2007 08:58:42 PM UTCdrayanAttached File-=>Added physics.tar.gz, #2742
    Thu 02 Aug 2007 08:54:14 PM UTCdrayanAttached 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