See what's going on with flipcode!




 


Submitted by , posted on 09 October 2000



Image Description, by


Collision fun in cube hell :

This is a little demo of my collision detection library, called Z-Collide. First of all, I guess the pic will get reduced, and you may not see what's going on here. So have a look at the original screenshot: www.codercorner.com/CubeHell.jpg

The upper left image contains 10000 cubes ready to be tested against the collision detection module, down to the triangle level, and including closest points computation while we're at it. No fear.

The upper right image shows 4096 of them in the worst possible scenario: randomly placed within a unit cube, colliding in all possible ways. The profiler keeps track of what happens at various levels and reports the number of cycles it takes to do the job.

The lower left (pretty confused) image shows the same kind of situation, with AABBs (Axis-Aligned Bounding Boxes) turned on. Green boxes are not colliding. Yellow boxes are colliding, not the actual cubes. Red boxes are colliding, and the cubes within as well.

The last image focus on a single pair. A white segment is drawn between two user-selected cubes, reporting their closest points, exact distance, and the contact manifold (Point-Point, Edge-Edge, Point-Face, etc). That contact manifold is very important for collision response, when the collision detection library is used as the heart of a rigid body simulator.

You can download the demo: www.codercorner.com/CubeHell.zip
The included readme file contains some more technical information.

On my Celeron 500 / GeForce / W98, it runs at 60~80 fps for 1024 cubes (which would need one million intersection tests with a naive O(n^2) way). Needless to say, the framerate drops for 10000 cubes (2~10 fps).

Of course, the lib works for arbitrary models, not just for cubes :)

Cheers,

Pierre



[prev]
Image of the Day Gallery
www.flipcode.com

[next]


 


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.