特定の距離で処理が発動する場合は、対象物との距離を測って
範囲内であれば、処理を行うようにします。
範囲から外れた後も永続処理する場合はフラグの処理が必要です。
When you want to trigger a process based on a specific distance, measure the distance to the target object. If it is within the specified range, execute the process.
If the process needs to continue even after the target moves out of range, you need to manage a flag.