Posted 06 March 2006 - 08:01 PM
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...
Posted 06 March 2006 - 08:49 PM
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.
Posted 07 March 2006 - 12:45 PM
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!
Posted 07 March 2006 - 04:48 PM
Currently working on: the 3D engine for Tomb Raider.
Posted 22 March 2006 - 08:00 PM
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