Collision detection improvements

This is a discussion on Collision detection improvements within the C++ Programming forums, part of the General Programming Boards category; <<< Split from dead thread http://cboard.cprogramming.com/cplus...detection.html - see the rules please >>> Does anybody know about other methods to reduce ...

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    1

    Collision detection improvements

    <<< Split from dead thread Programming Collision Detection - see the rules please >>>
    Does anybody know about other methods to reduce the number of collision test? What are the common methods to detect collision precisely and implement a realistic collision response which can handle point-pint interaction forces or surface friction forces.

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,509
    Hey, I'm about to start a 2d simulation program...and thought of solving the said problem in this way..
    1.Calculate the vector distance between the CM s of the objects in question....say x
    2.Let the extents of either body in *that direction be a & b
    3. if(x<=(a+b) <collision occurs>
    ....Any comments about how feasible it is?...I thought that it'd have accurate results ...But would it be too expensive?
    Last edited by manasij7479; 05-16-2011 at 09:50 AM.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    682
    Quote Originally Posted by Sunbel View Post
    Does anybody know about other methods to reduce the number of collision test? What are the common methods to detect collision precisely and implement a realistic collision response which can handle point-pint interaction forces or surface friction forces.
    Split level into sectors (if that's what you mean). For example, if your map's size is, lets say, 20000x10000 points, you can create 100x50 square sectors (each of 200x200 points). If an object A occupies 2 sectors (10;10) and (10;11) and another object B occupies also 2 sectors (10;11) and (11;11), there is a possibility that they collide in the sector (10;11). Access to sector is O(1). You pick only these objects, which are likely to collide, no matter how many objects are on the other edges of the map.

    The problem might appear when your map grows/shrinks dynamically.
    I never put signature, but I decided to make an exception.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    There are several optimizations you can do when collision testing to eliminate the need for an O(n^2) list. One of them is to separate the world into static and dynamic objects. Only test dynamic objects against other static objects. The list of dynamic objects is sure to be less than the number of static objects. Combine this with the aforementioned sectorized approach and/or a BSP or Quad-tree spatial data structure (depending on the type and usage of the world) as well as the common trivial rejection tests like sphere, AABB, OOBB, swept sphere, swept AABB (separating axis theorem) and you should be able to get good results.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Collision detection
    By jack_carver in forum C Programming
    Replies: 5
    Last Post: 02-08-2010, 06:52 AM
  2. Collision Detection
    By Grantyt3 in forum C++ Programming
    Replies: 3
    Last Post: 09-30-2005, 04:21 PM
  3. Collision Detection
    By cboard_member in forum Game Programming
    Replies: 2
    Last Post: 08-06-2005, 01:14 PM
  4. Collision Detection.
    By zergdeath1 in forum C++ Programming
    Replies: 5
    Last Post: 11-21-2004, 05:28 PM
  5. collision detection
    By tHaPuTeR in forum Game Programming
    Replies: 11
    Last Post: 09-22-2001, 11:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21