Collisions with 3D models.

Hello, I’m just starting to touch 3D. I made a little game 2d before that.

I have a 3D model (a simple cube)

I would like to start 3D collisions.
I search I find “BoundingBox” is “BoundingSphere”.

I really do not understand how it works.
How to change his positions to put them on my model.
How to draw it on the screen.
How it all works I can not find anything on the documentation.

I would also like to put a BoundingBox on the camera to not enter the model.

If someone has a topic or know how it works I would like to know too.
Many thanks to everyone who will help me.

There are lots of rescorces for 3d collision detection i suppose it is helpful to know some keywords to search for. Much of 3d collision detection occurs at the (broad phase) level because polyhedral geometry is more complex and thus more expensive in the (narrow phase). So eliminating objects that cannot possibly collide is much more important.

There is also a question of organization of 3d objects in 3d scene when collision detection is going to be requisite this is typically called a scene graph https://en.wikipedia.org/wiki/Scene_graph

Additionally there are two types of polyhedra… convex and concave some models are broken into to parts to make them convex specifically for simpler or faster collision detection.

In the old days and in raytracing you calculate the actual surface of the 3d objects via triangle surface normals (the same ones used for lighting typically) and test against other points for intersections via the dot product or other objects surface planes.
Games such as world of tanks uses this sort of collision for bullet deflects and on its parts via a simplified collision hull. However typically one of the below is used depending on the situation.

The below are all terms you can google up.
Polyhedron Collision (narrow phase only previously described)

Most of the below combine the idea of narrow and broad phase collision.
BSP trees; Binary spacial partitions
Octrees it’s 2d counter part is the quadtree
Hierarchical Bounding Volumes Hbv’s , synonyms hbv, bvh , vbh
k-d trees;
Bins;
R-trees;
ect…

While this one is 2d it delves into 3d a bit and has many many different terms.

3d wiki.


you can google tons more.
http://www.euclideanspace.com/threed/animation/collisiondetect/ < bounding boxes ect.
https://www.cse.iitk.ac.in/users/amit/courses/RMP/presentations/dslamba/index.html

There have been many 3d collision packages these are already made librarys you add to your project.
https://github.com/jslee02/awesome-collision-detection list of different librarys on github.
https://www.bepuentertainment.com/
https://github.com/mattleibow/jitterphysics

https://www.cse.iitk.ac.in/users/amit/courses/RMP/presentations/dslamba/index.html
or new ones coming out
https://www.neoaxis.com/news/neoaxis_engine_2019_1_announced
ect…

3 Likes

Thank you so much ! willmotil