We will entertain your mind, enhance your brain, expand your lifestyle.

A story of the ‘Logic’

Processing using Collider

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.

  • The collision cannot be detected unless the object is moved. It is not possible to disable the move button in the direction of the obstacle
  • Mesh Colliders cannot detect collisions with each other
  • If multiple Box Colliders are added separately, a collision notification will be sent to the Colliders that are not in contact. It also interferes with raycasting for touch detection.

Steady processing

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.