In Hepto, each puzzle is an exhibit, and commentary panel objects are placed on each exhibition. Player touch (click) this object to start the puzzle.
In the future, we would like to support game controllers, but in that case, the operation will be to focus the object (object is bordered, object bacames briter, etc.) instead of touching and press the button on the controller to start.
To focus an object, there is a method to automatically focus when the target object comes near the center of the screen. As an easy way to implement this, we try about attaching a collider in front of the camera and using it as a trigger.
Unfortunately, this didn’t work. Collider needed a physics component to trigger events, but adding this component made the Cinemachine camera behave strangely. This is the same with use Virtual camera.
Next, we examined the logic that the line-of-sight direction (vector in the front direction of the camera) and the vector from the camera to the target object are focused if they are within a certain angle.
However, since there are multiple objects for starting puzzles, it is not possible to calculate all of them at all times, so we narrowed down the processing under the following conditions.
As a result, it was possible to naturally focus the object to which the line of sight was directed without applying a large processing load.