Return to Home Courses

Collisions Detection

The original question Link

The Code and models used in this project

 

Introduction



In this project, I use SWIFT++ to detect collision among objects. It's very convient to use, and can detect allcollisions among many objects. Following is something need to note:

Notes SWIFT++
It only support watertight models
Deactivation is not necessary (where cost me a lot of time to find)
Add_Convex_Object function support fix/move and scale attritubes

Experiments

I use four obj modesl, read their vertices and faces and give them to Add_Convex_Object. These models are:

Names Vertice # Face #
Ball 162 320
Box 8 12
HighRes Ball 804 1600
Lion 5000 9996

Below is the running results. The first one record frames, the second one record collision detection times in one second, both with varying different models and objects number.

results1
results2
    From the two images, I have several observations:
    Observations
    both the running and collision detection time satisfy a quadratic curve regards to object number
    rendering is more time consuming than collision detection
    The complexity of object has little influence on collision detection, since swift++ may use surrounding area to simplify
    I change the scale from 1 ,2 ,4 ,8 , 10, and record the detection times and collision times in the following two images.
    Observations
    detection times decrease along with scale increase in a linear manner
    collision times increase exponentially along with scale increase



    Change the algorithm

    I adopt the bounding sphere algorithm and generate collision detection times (per second)-- object number and collision times -- object number graph.



      This method runs faster than Swift++, but for complex objects this method will be not accurate.

      © 2011–12 Dinghuang Ji