Skip to content

Wrong witness1 value for ShapeCastHit in cast_shapes_voxels_shape #373

@dylanowen

Description

@dylanowen

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions