|
-
Jun 2nd, 2001, 03:42 PM
#1
Collision Detection
Are there any tutorials on it for DOS?
-
Jun 2nd, 2001, 05:26 PM
#2
Monday Morning Lunatic
Shouldn't make any difference what you're programming for, since it's all theory 
You can surround objects with spheres and check that the distance of their centres isn't less than the sum of their radii (I think). If you want more accuracy you can have multiple spheres. From that it's possible to use bounding boxes as well.
http://www.cs.unc.edu/~geom/V_COLLIDE/
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 3rd, 2001, 04:19 PM
#3
Lively Member
But then theres...
What if its a weird shaped item, and you want the collision to be on the edges of the item, not just NEAR it. It would look weird if a ball hit a paddle, and was still 1/2 an inch away and it bounced off...
Just something to think about!
-
Jun 3rd, 2001, 04:23 PM
#4
Monday Morning Lunatic
This is why complex mesh objects are usually represented by a bounding box, and the object is decomposed into non-intersecting polygons to compare against (BSP trees).
First, check against the bounding box/sphere. If it's inside, check against each individual bounding box/sphere, until you eventually check against exact objects. This is for speed -- you can stick an entire tree into a bounding box and if you're over the other side of the world from the tree you're not checking against each individual leaf.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 3rd, 2001, 04:43 PM
#5
I think thats all a little much for a simple circle hitting a straight line.
-
Jun 3rd, 2001, 04:49 PM
#6
Monday Morning Lunatic
Hehehe Just a tad 
There's a formula for the distance of a point from a line:
Distance of point (a,b,c) from line
ux + vy + wz + d = 0
is given by:
Code:
|ua + vb + wc + d|
--------------------
sqrt(u^2 + v^2 + w^2)
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|