MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / raycast_all

Method raycast_all

native/shared/src/physics_jolt.rs:620–638  ·  view source on GitHub ↗
(
        &mut self, world_h: f64,
        ox: f32, oy: f32, oz: f32,
        dx: f32, dy: f32, dz: f32,
        max_distance: f32, layer_mask: u32, max_hits: u32,
    )

Source from the content-addressed store, hash-verified

618 /// Multi-hit raycast. Stores up to max_hits in the cache.
619 #[allow(clippy::too_many_arguments)]
620 pub fn raycast_all(
621 &mut self, world_h: f64,
622 ox: f32, oy: f32, oz: f32,
623 dx: f32, dy: f32, dz: f32,
624 max_distance: f32, layer_mask: u32, max_hits: u32,
625 ) -> u32 {
626 self.ray_hit_cache.hits.clear();
627 let world = match self.worlds.get(world_h) { Some(&w) => w, None => return 0 };
628 self.ray_hit_cache.hits.resize(max_hits as usize, unsafe { std::mem::zeroed() });
629 let n = unsafe {
630 bj_query_raycast_all(world,
631 BjVec3 { x: ox, y: oy, z: oz },
632 BjVec3 { x: dx, y: dy, z: dz },
633 max_distance, layer_mask,
634 self.ray_hit_cache.hits.as_mut_ptr(), max_hits)
635 };
636 self.ray_hit_cache.hits.truncate(n as usize);
637 n
638 }
639
640 pub fn ray_hit_count(&self) -> u32 { self.ray_hit_cache.hits.len() as u32 }
641 pub fn ray_hit_body(&self, i: usize) -> f64 {

Callers

nothing calls this directly

Calls 3

clearMethod · 0.45
getMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected