From ca8849818fa8995a7c7f72a5565220c126dd794c Mon Sep 17 00:00:00 2001 From: spatialfree Date: Sat, 9 Nov 2024 01:57:35 -0500 Subject: [PATCH] box held --- Platforms/Android/AndroidManifest.xml | 4 ++-- src/Mono.cs | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Platforms/Android/AndroidManifest.xml b/Platforms/Android/AndroidManifest.xml index f66c901..d9c1fd1 100644 --- a/Platforms/Android/AndroidManifest.xml +++ b/Platforms/Android/AndroidManifest.xml @@ -2,8 +2,8 @@ diff --git a/src/Mono.cs b/src/Mono.cs index 5a0954d..552f8ef 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -30,6 +30,8 @@ static class Mono public static XYZi food = new(2, 0, 0); public static double eat_timestamp = 0.0; + public static DeltaBool held = new(false); + public static void Init() { for (int i = 0; i < snake.Length; i++) @@ -57,8 +59,18 @@ static class Mono } } else - { - box_pose.position = Rig.head.position + Rig.head.orientation * V.XYZ(0, -(SD_Y + 0.5f) * box_scale, -32 * U.cm); + { + bool in_dist = Vec3.Distance(Rig.r_con_stick.position, box_pose.position) < 6 * U.cm; + held.Step(in_dist && Rig.btn_grip.state); + if (held.state) + { + box_pose.position = Rig.r_con_stick.position; + } + else + { + // orbital_view + box_pose.position = Rig.head.position + Rig.head.orientation * V.XYZ(0, -(SD_Y + 0.5f) * box_scale, -32 * U.cm); + } } XYZi next_pos = snake[0] + Rig.new_dir;