From 637fb38131f52f6dd95e2842a4a7456972b34640 Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Fri, 13 Mar 2026 18:38:24 -0700 Subject: [PATCH] factor in world offset --- lib/src/bvh.rs | 1 + lib/src/head.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/bvh.rs b/lib/src/bvh.rs index d074d49..8e598b0 100644 --- a/lib/src/bvh.rs +++ b/lib/src/bvh.rs @@ -73,6 +73,7 @@ impl Bvh{ } /// Find the exact timestamp on the bot timeline that is closest to the given point. pub fn closest_time_to_point(&self,bot:&CompleteBot,point:glam::Vec3)->Option{ + let point=point+bot.world_offset(); let start_point=vec3::try_from_f32_array(point.to_array()).unwrap(); let output_events=&bot.timelines().output_events; // grow a sphere starting at start_point until we find the closest point on the bot output events diff --git a/lib/src/head.rs b/lib/src/head.rs index 50f8296..39f474d 100644 --- a/lib/src/head.rs +++ b/lib/src/head.rs @@ -121,7 +121,7 @@ impl PlaybackHead{ } pub fn get_position(&self,bot:&CompleteBot,time:SessionTime)->glam::Vec3{ let interp=self.interpolate_output(bot,time); - interp.position() + interp.position()-bot.world_offset() } pub fn get_velocity(&self,bot:&CompleteBot,time:SessionTime)->glam::Vec3{ let interp=self.interpolate_output(bot,time);