Advertisement

What do we want from Collision Detection?

Started by December 08, 2000 03:31 PM
9 comments, last by Keermalec 23 years, 11 months ago
I can''t help but notice, after looking at all the collision detection code on the Internet, including NeHe''s lesson 31, that most advanced programmers have a different idea of what they want to use collision detection for, compared to newbes (like me). As far as I am concerned, I only need collision detection to avoid passing through walls. All those bouncing balls and stuff is great but that is far too advanced for simply checking that the camera keeps on the right side of the wall. Some time ago OGLman posted a really cool collision detection routine that was MUCH easier to understand and manipulate than Lesson 31''s. Its aim was simply to stop the camera from going through a wall. Lesson 31 looks like a thesis in vector maths to me, it is way above my head. Why not have developed a tut on OGLman''s code? Not passing through walls seems a much more important aspect of virtual worlds than having balls bounce perfectly in imitation of gravity. Why start with the more complex before finishing the basics?
I understand what you are saying, but if you only need a simple colision detection routine it shouldn''t be too hard to make one up yourself. We can''t rely on nehe himself to tell you everything.

I was sitting in english class a few days ago (bored out of my mind) so i made my own colison detection routine there. I was pretty suprised on how eay it was. And im not nessecarily the greatest programmer or mathematician either (i haven''t even come close learned trig yet in school im just working with matricies and dot products and trig from stuff i''ve learned off the internet). My engine that im working on is just a basic terrian engine with trees and water and whatnot, so i dont really need an advanced one.

A couple of notes that some one might want when making a colision detection routine:

1) make each tree, shrub or person have a radius that is the threshold of colisions (the camera cannot go into this radius)

2) find the tree shrub or person that is closest to you (shouldn''t be too hard with some sin() & cos() or pythagoran therom)

2) make it so the camera can only move if the distance between the camera and the position of the model that is closest to you is greater than the radius of that model. that might sound like a different language to some, but if i could show you on paper it would be dead simple.

.player...tree
............_
........../...\
....P.....|...|
..........\._./

if the radius of that tree is greater than the distance between the the player and the tree''s center, the player must be inside the tree so dont allow the player to move.
Hope this helps someone. (and i hope that diagram turns out on the message board)
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
Advertisement
Thanks for the tips, Psionic. The fact is, even a simple camera-object collision routine does have a lot of details to work out. For example, when you hit an object, you would like to slide off it and not simply come to a full stop. When you hit a step you would like to step over it. You would also like a form of gravity keeping the camera always 160 cm over the ground and moving up and down with the ground''s irregularity. Also, how do you stop the collision-detection routine from checking too many intersections that would slow down the engine? A sphere is good for the camera or for a bush but a cylinder is better for a tree trunk, and a rectangle is better for a wall. All these things could be talked about and discussed if there was a tutorial on it: I am sure there are many ways to make camera-object collision work but one may be "easy" and another may be "better". If people were to post and compare different methods we could probably develope somthing real cool and real fast.
What I''d like to know if how to check between a point and an arbitrary polygon...

I know how to find out if a point is on a plane (dot product) but if it''s on there, how do I know if it''s within a particular triangle on the plane?

I was thinking some sort of 2d dot products, using the winding of the points, and if you''re in front of them all, you''re inside the poly, if not, no collision...

Can anyone help me out on this one? Cheers!

Are you interested in SETEC ASTRONOMY?
_________________________________I used to be indecisive. Now I'm not so sure...
I could write a tutorial for my code and I offered to do that when I first posted it but no one wanted me to they. No one even had any questions about how it worked. So I thought no one had any problems with it. But if you want me to I could write it and post it on that pathetic site of mine.



Open mouth, insert foot
for line-triangle intersection, downl the dx8sdk, there is an example bout it

but dont use it often, it takes alot of time and is not really usefull when you dont have a really fast engine. the nehetut shows just one thing:
collisiondetection is engine dependend, means for a quake-like game, you use mostly triangletests, for a landscapeengine u use linearinterpolation between the points and spericals for the items on it (units in stratecy, for example..) and and and, just think bout it

we wanna play, not watch the pictures

If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
That''d be appreciated oglman.
_________________________________I used to be indecisive. Now I'm not so sure...
OGLman, I did say I was interested in a tutorial on your collision-detection routine back then, if you remember. But I also remember very few other people interested, strangely enough. I think you should just ignore the apparent lack of interest and go along with it. Your code is good, fast, and straightforward and I think it can very well be a standard once the wall-entering-thru-the-angle problem is fixed. I admit I do not completely understand it, even though I was able to port it to lesson23, but that is due to my lack of knowledge in C++. All I know is I will understand it more easilly than I would lesson31, which I won't even try to look into (for now).

I think a simple explanation of the code and the algebra would be very welcome indeed. I look forward to trying to implement other aspects of collision detection (gravity, stepping over small obstacles, ...etc) after your tutorial comes online.

Great job, please keep it up.



Edited by - keermalec on December 10, 2000 1:32:33 PM
Great! I have started on the tutorial that will explain the collsion function and it will probably be posted on my website (www.geocities.com/michael53711/). It will probably be done by Wednesday or Saturday at the very latest but when I do post it I will tell people here.



Open mouth, insert foot
cool!

This topic is closed to new replies.

Advertisement