Posts Tagged‘BPY’

Simple 3D Collision Detection with Python Scripting in Blender

by Paul Balzer on 8. Juni 2016

3 Comments

If you are looking for a very simple way to check, if two objects touch each other in Blender, maybe this might be a solution. The field of collision detection is very popular in game development and these guys have a lot of special algorithms for fast and/or exact collision between circles & circles, rectangles & circles, triangles & circles and so on…

Most of these are based on the Seperating Axis Theorem, which is simply the mathematical solution of the question: Is it possible to look ‘between’ the two objects from any direction? If so, they are not colliding. Things get much simpler, if you just check the bounding boxes of two objects. In case of a cube, the bounding box is exactly the object itself. To check if two cubes touch each other, you have to check a collision between two bounding boxes. To make it even easier, one of the boxes is axis aligned (not rotated). We are talking about AABB (axis aligned bounding box) 3D collision check in Python. For visualization, we are using Blender. In Blender, you can run Python scripts.

Continue Reading