We are programming Hepto’s puzzle logic. The puzzle we are making is to move multiple picture frames to solve. The picture frame must not cross over other picture frames or perimeters. Such logic we needed, but it is difficult that the shape of the picture frame is not a rectangle but a polygon with a dent like “L”.
First we decided to use Unity’s Collider. It’s a feature of Unity, and Mesh Collider can handle dented shapes. However, there were some problems with this.
Therefore, in the traditional process, the range in which the frame moves is divided into movement units to form an array, and the bit patterns in the shape of the frame are arranged in th array. It is simple, requires less calculation, and can detect collisions before moving.
If there is a problem, it is necessary to prepare a bit pattern according to the shape, and it is not possible to handle complicated shapes and three-dimensional objects. At that time, we will have to create our own collision detection logics.