Results 1 to 5 of 5

Thread: Round object collision detection

  1. #1

    Thread Starter
    Member Yhoko's Avatar
    Join Date
    May 2002
    Posts
    47
    VB Code:
    1. Dim Distance as Single
    2.  
    3. Distance = Sqr( (Obj1.x - Obj2.x)^2 + (Obj1.y - Obj2.y)^2 )
    4.  
    5. If Distance < Radius1 + Radius2 Then
    6.    'Collision!
    7. EndIf
    - Yhoko


    Try my Games
    * [VB6] YDK - Yhoko's Development Kit
    * [VB6] HackV1 - two-player puzzle/strategy
    * [VB6] Xen - extended Gen

  2. #2
    Lively Member Liquid Pennies's Avatar
    Join Date
    Jun 2002
    Location
    Charlotte, NC
    Posts
    124
    uh, are you displaying code for everyone to use...or asking a question?

    im not really sure what you want, but ill tell you this, detecting colission of not rectangular objects is a b****

  3. #3
    Zaei
    Guest
    Actually, It looks like a post with no body =). Yhoko was kind enough to post some general code in response to the subject (helpful subjects are so.. helpful =).

    Z.

  4. #4
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Here is a little program i made demonstrating that collision detection, with others.

    http://209.120.143.185/showthread.ph...hreadid=177612
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  5. #5
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    SORRY

    Sorry about that, I was having some trouble with my computer, just got the internet back on line after it crashed before I could complete my post.

    Yhoko, thanks a lot! That code works very very well!

    Thanks

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