Jump to content


- - - - -

"Sliding" Collision


6 replies to this topic

#1 Spessotto

    New Member

  • Members
  • Pip
  • 3 posts

Posted 06 March 2006 - 08:01 PM

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!

#2 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 939 posts

Posted 06 March 2006 - 08:49 PM

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.

#3 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 06 March 2006 - 09:30 PM

This is a maths topic :).
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#4 erkokite

    New Member

  • Members
  • PipPip
  • 12 posts

Posted 06 March 2006 - 09:54 PM

see here:
http://www.gamedev.n...article1026.asp
and here:
http://www.gamedev.n...hpage=1

#5 Spessotto

    New Member

  • Members
  • Pip
  • 3 posts

Posted 07 March 2006 - 12:45 PM

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!

#6 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 07 March 2006 - 04:48 PM

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.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#7 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2722 posts

Posted 22 March 2006 - 08:00 PM

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]





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users