Detecting that a mesh is near another mesh

Hi, a simpleish question of the best way to detect a mesh when another mesh is nearby. Consider the picture down below.

The smiling cube is just sitting there until the other cube comes into its radius. Then, it does something after noticing this. So is the best way to detect that the other mesh is nearby simply to create an invisible sphere around the mesh that wants to see if another mesh is close by (and using intersection)? Or are there more elegant solutions to this problem?

You could calculate the distances between the cubes bounding spheres rather than creating actual invisible spheres.


Thank you @blindinghues :sunglasses:
The solution works well!

1 Like