-
-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Description
parry/src/query/shape_cast/shape_cast_voxels_shape.rs
Lines 23 to 42 in d955f75
| let mut check_voxels_in_range = |search_domain: [Point<i32>; 2]| { | |
| for vox in g1.voxels_in_range(search_domain[0], search_domain[1]) { | |
| if !vox.state.is_empty() { | |
| // PERF: could we check the canonical shape instead, and deduplicate accordingly? | |
| let center = g1.voxel_center(vox.grid_coords); | |
| let cuboid = Cuboid::new(g1.voxel_size() / 2.0); | |
| let vox_pos12 = Translation::from(center).inverse() * pos12; | |
| if let Some(new_hit) = dispatcher | |
| .cast_shapes(&vox_pos12, vel12, &cuboid, g2, options) | |
| .ok() | |
| .flatten() | |
| { | |
| if new_hit.time_of_impact < smallest_t { | |
| smallest_t = new_hit.time_of_impact; | |
| hit = Some(new_hit); | |
| } | |
| } | |
| } | |
| } | |
| }; |
The returned witness1 should be in local space for the voxel shape. However, we delegate the shape cast to a cuboid representing the individual voxel and never transform the result from this hit back into voxel-shape space.
Metadata
Metadata
Assignees
Labels
No labels