diff --git a/src/Rig.cs b/src/Rig.cs index 95844fe..ac1f575 100644 --- a/src/Rig.cs +++ b/src/Rig.cs @@ -97,6 +97,27 @@ static class Rig if (ax > ay && ax > az) new_dir = new(Maths.sign(fullstick.x), 0, 0); if (ay > ax && ay > az) new_dir = new(0, Maths.sign(fullstick.y), 0); if (az > ax && az > ay) new_dir = new(0, 0, Maths.sign(fullstick.z)); + + // sheathe grabs + // shoulders + // put hand in head space + // if behind head then handedness = left or right sheathe + // else check for left or right of head to grab at left or right sheathe + for (int i = 0; i < (int)Handed.Max; i++) + { + if (!holding[i]) + { + Vec3 local_pos = head.orientation.Inverse * (pose_hld[i].position - head.position); + Handed side = local_pos.x < 0 ? Handed.Left : Handed.Right; + if (upper_sheathes[(int)side]) + { + if (btn_grip[i].delta == +1) + { + upper_sheathes[(int)side] = false; + holding[i] = true; + } + } + } } } }