Could you put a car in to s square box?
: Sory for my bad english ! If someone could corect this , please do it!
:
: Collision detections algorithms are implemented through intersections results between two or more primitives ( the primitives are basic 3D objects : cube , sphere , pyramids ...) or the triangles from the scene and the primitives .
:
: The intersection calculations for primitives are used to get the collision between the objects in the scene (excluding the walls - for a 3dShooter game) .
:
: Objects are situated inside an aproximation primitive (circle ,sphere , rectangle , box) ,because these primitives aproximates the shape of the object .
:
: Those aproximation primitives can be :
:
: - spheres
: - AABB(Axis Aligned Bounding Box) . The object is situated inside a box whose faces are paralels with coordinating axis .
: - OBB(Oriented Bounding Box) . The object is situated in the smallest box that can be created. It aproximated the object volume at best .
:
: I'll explain the spheres aproches :
:
: Let it be 2 objects . Put these objects in 2 speheres( or circles) .
: These Spheres are : S1(center1,radius1) & S2(center2,radius2)
: distance = the distance from center1 to center2
: if distance is less than radius1+radius2 well u MIGHT have a collision . :) . I repeat U MIGHT have a collision .
:
: if (distance< radius1+radius2) ColisionCouldBePossible();
: else ColisionIsNotPossible;
:
: Examples :
:
: (example1)
:
: ---------------
: / \
: / \
: / \
: / \
: | ******** |
: | * any * |
: | * * |
: | * object * |
: \ ******** /
: \ /
: \ /
: \ /
: ---------------
: Collison is not possible
: ---------------
: / \
: / \
: / \
: / \
: | ----- |
: | / \ |
: | -- a car --- |
: | | | |
: \ ---O--------O-- /
: \ /
: \ /
: \ /
: ---------------
:
:
: (example2)
:
: ---------------
: / \
: / \
: / \
: / \
: | ******** |
: | * any * |
: | * * |
: | * object * |
: \ ******** /
: \ --------------- /
: \/ \/
: /\ /\ Colission is still not
: / --------------- \ possible
: / \ The spheres are intersecting but
: | ----- | the objects don't
: | / \ |
: | -- a car --- |
: | | | |
: \ ---O--------O-- /
: \ /
: \ /
: \ /
: ---------------
:
:
: Now let's take another example , let's say in a 3d Shooter we have to test if a rocket will hit a character(human) , and where . So we put our rocket in a sphere and the human in another one . If the spheres are intersecting we might have a collision , so we test further .
: Now we pot the upper part of the human body in a sphere , and the lower part in another one , and test again for a intersection . Let's say the rocket sphere intersect the sphere of the upper part of the body .
: No we put the head in a sphere , the chest in a sphere , the shoulders in another 2 spheres , the uper parts of the arms in another 2 spheres and so go on ... we test for intersection again . :)
:
: The fixed parts of the scene (walls , stairs , floor ,etc ) can not be aproximated with primitives . For collision detection u have 3 choiches .
: U have to test for intersection between the primitive of the object and :
: 1) the scene's triangles (this is what are u doing in your example i guess) . This test might be a problem if the scene has many triangles and the quality collision it's not so good .
: 2)the scene's polygons . U must put the triangles toghether , when u design the level of the game, in convex polygons .The test will be through the primitive and a reduced set of convex polygons .
: 3)planes wich aproximates geometry . U have to cut the level in collision planes , which aproximate the level geometry . The test are between the primitive and the planes which are closer . This method does not dependend on the numbers of triangles involved in the scene . It's widely used in engines BSP tree based .
:
: Huh ! That's all for now . If u think it's not enough or u don't understand i think i can give u a more detailed explanation (with pictures . I think i can make a web page )
:
: That's all and good luck !
:
: P.S. AABB and OBB cases are somewhat similar with the sphere test but they can provide a better aproximation , and also they might be slow in comparation with the sphere tests .
: