pub fn voxel_cursor_impact_system(
    bvt: Res<VoxelBvt>,
    cursor_ray: Res<CursorRay>,
    mut voxel_cursor_impact: ResMut<VoxelCursorRayImpact>,
) {
    voxel_cursor_impact.maybe_impact = None;
    voxel_cursor_impact.normal = None;

    if let CursorRay(Some(ray)) = *cursor_ray {
        if let Some(impact) =
            cast_ray_at_voxels(&*bvt, NCRay::from(ray), std::f32::INFINITY, |_| true)
        {
            let normal = Point3f::from(impact.impact.normal.normalize())
                .round()
                .in_voxel();
            if let Some(normal_axis) = SignedAxis3::from_vector(normal) {
                voxel_cursor_impact.normal = Some(normal_axis);
            }
            voxel_cursor_impact.maybe_impact = Some(impact);
        }
    }
}
/// Each frame, a ray is cast at the `VoxelBvt`, and the resulting impact is stored.
Each frame, a ray is cast at the `VoxelBvt`, and the resulting impact is stored.
Each frame a ray is cast at the ` VoxelBvt ` and the resulting impact is stored .
pub fn voxel_cursor_impact_system(
    bvt: Res<VoxelBvt>,
    cursor_ray: Res<CursorRay>,
    mut voxel_cursor_impact: ResMut<VoxelCursorRayImpact>,
) {
    voxel_cursor_impact.maybe_impact = None;
    voxel_cursor_impact.normal = None;
    if let CursorRay(Some(ray)) = *cursor_ray {
        if let Some(impact) =
            cast_ray_at_voxels(&*bvt, NCRay::from(ray), std::f32::INFINITY, |_| true)
        {
            let normal = Point3f::from(impact.impact.normal.normalize())
                .round()
                .in_voxel();
            if let Some(normal_axis) = SignedAxis3::from_vector(normal) {
                voxel_cursor_impact.normal = Some(normal_axis);
            }
            voxel_cursor_impact.maybe_impact = Some(impact);
        }
    }
}
pub fn voxel_cursor_impact_system ( bvt : Res < VoxelBvt > , cursor_ray : Res < CursorRay > , mut voxel_cursor_impact : ResMut < VoxelCursorRayImpact > , ) { voxel_cursor_impact . maybe_impact = None ; voxel_cursor_impact . normal = None ; if let CursorRay ( Some ( ray ) ) = * cursor_ray { if let Some ( impact ) = cast_ray_at_voxels ( & * bvt , NCRay :: from ( ray ) , std :: f32 :: INFINITY , | _ | true ) { let normal = Point3f :: from ( impact . impact . normal . normalize ( ) ) . round ( ) . in_voxel ( ) ; if let Some ( normal_axis ) = SignedAxis3 :: from_vector ( normal ) { voxel_cursor_impact . normal = Some ( normal_axis ) ; } voxel_cursor_impact . maybe_impact = Some ( impact ) ; } } }
Each frame, a ray is cast at the `VoxelBvt`, and the resulting impact is stored.
Each frame a ray is cast at the ` VoxelBvt ` and the resulting impact is stored .
bvt
Res<VoxelBvt>
cursor_ray
Res<CursorRay>
voxel_cursor_impact
ResMut<VoxelCursorRayImpact>
bvt
Res<VoxelBvt>
cursor_ray
Res<CursorRay>
voxel_cursor_impact
ResMut<VoxelCursorRayImpact>