"Sliding" Collision

C5d125dc492efd1b3a1d8d076d39fa1b
0
Spessotto 101 Mar 06, 2006 at 20:01

Hello Guys…i will try to explain my problem (sorry the bad english ok)..??

I´m making a shooter in DevC++ with OpenGl…and i am new in collisions….but i made a “bounding box” collision..ok it works…but i want to do that collision like the professional games do, that when the user collides, it slides for the side…but i want the code in opengl, because my friend try to explain the “mathematics” , hehe but i cant understand…

hehe i hope you understand my problems…

Thanks!

6 Replies

Please log in or register to post a reply.

820ce9018b365a6aeba6e23847f17eda
0
geon 101 Mar 06, 2006 at 20:49

That is not OpenGL code, just mathematics, so listen to your friend.

Trying to be a bit more helpfull: Exactly in wich situations to you need sliding? If you only have axis aligned bounding boxes, there won’t be any sliding.

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Mar 06, 2006 at 21:30

This is a maths topic :).

C5d125dc492efd1b3a1d8d076d39fa1b
0
Spessotto 101 Mar 07, 2006 at 12:45

its because my friend tell only the mathematic, but i dont know how do this in opengl code…I want the sliding when the user collides with one box, and if he is turned to the left, he slides to the left, if he is turned to right, he slides to the right…

baldurk: This is nos a math topic, because i want to know if someone know how to this in opengl …

erkokite: Im trying to see the pages you send, but says im not authorized…

but thank you for the answers!

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Mar 07, 2006 at 16:48

OpenGL is an API to draw 3d geometry. What you want to achieve has nothing to do with drawing, so OpenGL is out of the question. It’s pure math, there is no OpenGL code that does this.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 104 Mar 22, 2006 at 20:00

heres a way to implement wall sliding for a fps type map.
i had code for it but i cant find it on my computer… sorry, anyway
ill try to explain it.
for starters you need a ray-triangle intersect.
then for each wall in your map, hopefully only the ones that are close
to the object, if you code it right, you cast a ray out from the object pointing
at the inverse of the walls normal (a vector that fires out from the wall the way the walls “pointing”) so you want the inverse of this, it sorta points backwards from the wall instead of forwards.
if the ray intersects with the wall at distance less than the radius of the
object then you have found a collision, so to
implement sliding you push back the walls normal the the radius of the object minus the distance of the intersection.

if your a quick one, you should work out that this system lets you pass through the edges of the walls cause the ray firer misses to the side, this
algorythm only works if your map is all enclosed… anyway, hope you understand. this is a good way to get started though.

[EDIT] you could probably fix that by extending the walls planes length to the objects radius each edge somehow… [EDIT]