Discussion:
Intersection
(too old to reply)
Jean-Christophe
2014-05-17 13:21:15 UTC
Permalink
Hi all,

Does OpenGL provide a way to detect
that two objects are intersecting ?

( for instance, to avoid an object passing through a wall )

If it doesn't, would you be so kind to tell me how I can implement
such a thing without having to compare all coordinates of all objects ?

TIA
Cathy L.
2014-05-17 16:13:30 UTC
Permalink
Hello
No, OpenGL is only a 3D rendering API. For collision detection, try
googling for "ray triangle collision/intersection" (yes, you need to
detect collision with every triangle that may be an obstacle).
There are lot of improvement to avoid detecting every triangle of the scene.
Hope this helps
Cathy L.
Post by Jean-Christophe
Hi all,
Does OpenGL provide a way to detect that two objects are intersecting ?
( for instance, to avoid an object passing through a wall )
If it doesn't, would you be so kind to tell me how I can implement
such a thing without having to compare all coordinates of all objects ?
TIA
Jean-Christophe
2014-05-17 19:26:47 UTC
Permalink
Um, thank you Cathy.
Post by Cathy L.
Hello
No, OpenGL is only a 3D rendering API. For collision detection, try
googling for "ray triangle collision/intersection" (yes, you need to
detect collision with every triangle that may be an obstacle).
There are lot of improvement to avoid detecting every triangle of the scene.
Hope this helps
Cathy L.
Post by Jean-Christophe
Hi all,
Does OpenGL provide a way to detect that two objects are intersecting ?
( for instance, to avoid an object passing through a wall )
If it doesn't, would you be so kind to tell me how I can implement
such a thing without having to compare all coordinates of all objects ?
TIA
R.Wieser
2014-05-18 08:39:50 UTC
Permalink
Hello Jean-Christophe,

Cathy is right, OpenGL is a *rendering* component.

You could do all the intersection calculation yourself -- there are
math-related sites that will show you the formule which you than only need
to implement (keyphrase for google: "triangle triangle intersection", *with*
those doublequotes!), and even more important, do that in such a way that
the number of checks does not exponentially grow (brute-forcing those checks
would need almost the number of planes to the power of two. In other words:
100 triangles causes the need for almost 10,000 checks.).

The other way is to find a ready made component, in the same way OpenGL is
one. You could try the keywords "physics engine" on google.

Hope that helps.
Rudy Wieser


-- Origional message
Post by Jean-Christophe
Hi all,
Does OpenGL provide a way to detect
that two objects are intersecting ?
( for instance, to avoid an object passing through a wall )
If it doesn't, would you be so kind to tell me how I can implement
such a thing without having to compare all coordinates of all objects ?
TIA
Jean-Christophe
2014-05-18 08:45:31 UTC
Permalink
Okay, thank you Rudy.
Post by R.Wieser
Hello Jean-Christophe,
Cathy is right, OpenGL is a *rendering* component.
You could do all the intersection calculation yourself -- there are
math-related sites that will show you the formule which you than only need
to implement (keyphrase for google: "triangle triangle intersection", *with*
those doublequotes!), and even more important, do that in such a way that
the number of checks does not exponentially grow (brute-forcing those checks
100 triangles causes the need for almost 10,000 checks.).
The other way is to find a ready made component, in the same way OpenGL is
one. You could try the keywords "physics engine" on google.
Hope that helps.
Rudy Wieser
-- Origional message
Post by Jean-Christophe
Hi all,
Does OpenGL provide a way to detect
that two objects are intersecting ?
( for instance, to avoid an object passing through a wall )
If it doesn't, would you be so kind to tell me how I can implement
such a thing without having to compare all coordinates of all objects ?
TIA
Loading...