Results 1 to 5 of 5

Thread: Collision Detection

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    Do any of you have any source of how to do collision detection in Visual Basic using Direct X 7.0 ?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Well, there are more complicated methods, but the sphere-boundary one is useful enough. First, create a sphere large enough to hold the whole object, then compare the radii of that and another object's bounding sphere. If they collide, either claim a collision there, or move onto a slower but more accurate method, such as polygon piercing. I don't know too much, but it's a possibility.
    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
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    To do that, would you identify the vector between the two sphere's centres and then check the length to see if it's less than the sum of the two radii? Or is there an easier method?

    This isn't something I know about so I'm just interested.
    Harry.

    "From one thing, know ten thousand things."

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341

    Arrow Ok,

    anyone else have some code demos on how to do it. I will have a look on PSC for some stuff too.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That's exactly as Harry said...
    Code:
    If sqr((A.X-B.X)^2+(A.Y-B.Y)^2+(A.Z-B.Z)^2)<ARadii+BRadii then ... (check for collisions with vertexes inside the other object)
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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