From 2a73f8a469437f34e10f39769428ddbe9dda27e9 Mon Sep 17 00:00:00 2001 From: Quaternions <krakow20@gmail.com> Date: Tue, 18 Feb 2025 13:15:04 -0800 Subject: [PATCH] wip --- engine/physics/src/physics.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/physics/src/physics.rs b/engine/physics/src/physics.rs index 3fd2340..fc14ad6 100644 --- a/engine/physics/src/physics.rs +++ b/engine/physics/src/physics.rs @@ -980,6 +980,14 @@ impl PhysicsContext<'_>{ } } impl PhysicsData{ + pub fn trace_ray(&self,ray:strafesnet_common::bvh::Ray)->Option<ModelId>{ + let (time,convex_mesh_id)=self.bvh.sample_ray(&ray,Time::ZERO,Time::MAX,|&model,ray|{ + let mesh=self.models.mesh(model); + // TODO: ray tracing lol + None + })?; + Some(convex_mesh_id.model_id.into()) + } /// use with caution, this is the only non-instruction way to mess with physics pub fn generate_models(&mut self,map:&map::CompleteMap){ let mut modes=map.modes.clone();