Results 1 to 6 of 6

Thread: Collision Detection

  1. #1
    ChimpFace9000
    Guest

    Post Collision Detection

    Are there any tutorials on it for DOS?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  3. #3
    Lively Member
    Join Date
    Dec 2000
    Location
    Indiana
    Posts
    73

    Exclamation 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!

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  5. #5
    ChimpFace9000
    Guest
    I think thats all a little much for a simple circle hitting a straight line.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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
  •  



Click Here to Expand Forum to Full Width