| 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 { |