Results 1 to 5 of 5

Thread: Collision Detection.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    19
    I need to know the fastest and most optimized way to detect 3D objects in DirectX IM. Are there any good tutorials around to explicitly learn about collision detection? If so please tell me. If not and you do know how to detect collisions please tell me also. Thank you.

  2. #2
    Guest

    ok,

    ok,

    well, i don't know about the first one, and i don't know if this is the answer youre looking for on the second one, but i detect collisions using this code:

    (i don't know how to make that code thing, please tell me!)

    Public Sub LaserHit()

    If z = 1 Then GoTo 12

    If Laser.Left >= guy.Left And Laser.Left <= guy.Left + guy.Width And Laser.Top <= guy.Top + guy.Height And Laser.Top > guy.Top Then
    MsgBox "you hit him"

    z = z + 1
    12

    End If
    End Sub

    thats the basic code i use, hope thats what youre looking for, but if anyone else out there knows, and i know you do!, how to change the picture each time the laser hits. up to four times? thanks

  3. #3
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355
    but he needs 3d collision detection, which is harder..

    btw, your collision detection thing could be better by saying

    if Laser.Left < guy.left Or laser.left > guy.left + guy.width ..etc Then

    'NOT HIT

    else

    'HIT

    endif

    using Or means that if an early check fails (say if laser.left is bigger than guy.left) then the other parts of the If arent checked, making it faster. not much, but a little
    buzzwords are the language of fools

  4. #4
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Actually I'm pretty sure that both logical statements are checked every time in VB. In C and some other languages it's like you say Kennny, but VB does it the long and crap way.
    Harry.

    "From one thing, know ten thousand things."

  5. #5
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355
    im pretty sure i read that VB can do shortcuts..i know its language specific, but I thought VB supported it. anyone know 4 sure?
    buzzwords are the language of fools

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