Collisions.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Collisions.

  1. #1
    Join Date
    Feb 2005
    Posts
    10

    Collisions.

    I was just wondering how you go about doing collisions. The easy way is to do the 'intersect' code, but that works only with rectangles. Another way is to have the coordinates of each line and check with something that has the coords of the character and the object with the boundaries, but then round objects can still be a problem. Also, if you happen to have a thin 'pole' in the middle of the playing field and its width is smaller than the distance you are traveling you might pass right through it.

    Anyways, all that was said to ask: How do you go about collision detection?

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Your code must have a way to determine if two graphical objects share some
    2D space. One way to do it is to make an abstract superclass that extends the
    Polygon class and defines some basic methods like draw, move and perform and also
    has a defined center Point. Descendants from this class should easily give the
    collision precision you need.
    eschew obfuscation

  3. #3
    Join Date
    May 2005
    Location
    Denmark / Copenhagen
    Posts
    15
    Hi
    I will sugestd that you take a closer look at this homepage:
    http://www.diku.dk/~kenny/pubs.html
    This homepage has some good stuff about collision detection.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center