PDA

View Full Version : Collision methods?



06-20-2006, 05:19 PM
OK...lemme list 'em off:

-Distance
-Box Collision

These are the methods I'm able to use. Silence mortals, for I speak:

Unfort-tune-ate-ly...I need a more accurate collision method to handle collision detection with more complex and/or irregularly shaped objects. Since my math skills are only at the Grade 11 Pre-Cal level...I can't really do too much advanced math. Can anyone please suggest something? Thanks!

06-20-2006, 07:55 PM
The OpenGL API has no direct support for collision detection, though there are GPGPU techniques for performing some intra-object/particle collisions for effects.

Have a peek in the math & algos forum (where this belongs) or do a google search for "collision detection" or "physics SDK".

Have a nice day.

BramGo
06-21-2006, 09:48 AM
I don't know if I am doing this the way it should be done, because I'm still very new to this: But to do this I have a class PointCollection for each polygon, triangle, square that I draw. For me it's easy to implement the following 2 functions there:

public bool intersect(PointCollection p2);
public int distance(PointCollection p2);

Well to calculate distances it's really only a matter of using some pythagoras rules like:
C²=B²+A². If you are programming in Java Or .NET there are also Rectangle classes that contain intersect functions by default. Or you could write your own intersect function. Really shouldn't be so hard if you picture it in your mind like it's a 2D situation. (I used to program a SuperMario clone that had the same kind of functions for 2D collision.)

Next comparing if whole objects intersect is just a matter of looping through them.

But like I said before I am indeed a mortal :( . So maybe you experienced programmers have far better methods of doing this.

Greetings !

Zath
06-21-2006, 02:07 PM
Here's a physics engine I have been trying out while learning openGL.

Works great for what I need....

http://www.tokamakphysics.com/

Zath

06-24-2006, 08:36 AM
Thanks, when I go famous I'll thank you guys for all the support.