DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Collision Detection...  (Read 7,151 times)

Codebyte

  • "Premature Optimization is the root of all evil."
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 160
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Plugin Coding Medal
Collision Detection...
« on: July 14, 2008, 12:24 AM »
Anyone familiar with a good collision detection algorithm for 2 objects? Im messing around with a networked game atm.. bored, lol
CodeByter.com - http://www.codebyter.com

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Collision Detection...
« Reply #1 on: July 14, 2008, 12:32 AM »
i would suggest you use a graphics and phsysics library combo with support functions for this kind of thing.

Codebyte

  • "Premature Optimization is the root of all evil."
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 160
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Plugin Coding Medal
Re: Collision Detection...
« Reply #2 on: July 14, 2008, 12:42 AM »
know anything good from personal experience?
CodeByter.com - http://www.codebyter.com

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Collision Detection...
« Reply #3 on: July 14, 2008, 12:43 AM »

f0dder

  • [Well, THAT escalated quickly!]
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
    • Participated in NANY Challenge Once
Re: Collision Detection...
« Reply #4 on: July 14, 2008, 01:01 AM »
Split your world into sectors. Within each sector, start by doing an inexpensive initial test (usually bounding boxes or spheres), and for potential hits, possibly do a more correct (and expensive) test.

How to partition, how to do initial-test, and how to do expensive-test all depend on your game... 2D vs. 3D, data structures you use, etc.

But as mouser said, you might want to grab an existing engine unless you feel like doing your own collision detection for the sheer learning experience :)
- carpe noctem

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 9,827
    • Participated in NANY Challenge Eight Times
    • Cody Award
Re: Collision Detection...
« Reply #5 on: July 14, 2008, 02:10 AM »
If you're working with 2D Objects, then Torque Game Builder should be a sufficient engine as far as collisions are concerned.

But it might be a little difficult to figure out the networking parts.

Original address: https://www.donationcoder.com/forum/index.php?topic=14048.0