home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!root44!hrc63!mrcu!paj
- From: paj@uk.co.gec-mrc (Paul Johnson)
- Newsgroups: comp.programming
- Subject: Re: Collision Detection
- Message-ID: <1854@snap>
- Date: 28 Jul 92 08:12:28 GMT
- References: <18052.2a6ea82e@levels.unisa.edu.au> <Jul27.233802.41110@yuma.ACNS.ColoState.EDU>
- Reply-To: paj@uk.co.gec-mrc (Paul Johnson)
- Organization: GEC-Marconi Research Centre, Great Baddow, UK
- Lines: 27
-
- In article <18052.2a6ea82e@levels.unisa.edu.au> Andrew writes:
- > Does anybody out there know of a fast efficient way to detect and handle
- > colliding objects in two dimensions (there may be multiple objects colliding
- > as well)...
- >
- > it may be a similar problem to gas particles colliding...
-
- Depending on the numbers of objects and their sizes relative to the
- screen, it may be worth while setting up an array or hash table of
- screen zones. If you have only a few percent of the screen occupied
- by objects then a hash table will be more memory efficient. I'll let
- you work out the tradeoffs for yourself.
-
- The idea is that the screen is split into (say) 100x100 zones. If an
- object is in (or partly in) a zone then it is entered into a list of
- objects in that zone. Then you only have to do collision detection on
- the small number of objects which are nearby.
-
- If your objects follow simple trajectories then you can also do the
- collision detection when the trajectory is set up.
-
- Paul.
- --
- Paul Johnson (paj@gec-mrc.co.uk). | Tel: +44 245 73331 ext 3245
- --------------------------------------------+----------------------------------
- These ideas and others like them can be had | GEC-Marconi Research is not
- for $0.02 each from any reputable idealist. | responsible for my opinions
-