Skip to content

Commit

Permalink
Make fallbacks a bit more sophisticated
Browse files Browse the repository at this point in the history
  • Loading branch information
janhohenheim committed Aug 20, 2024
1 parent b99b885 commit 25e2c9b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/interaction/hold/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,17 @@ fn collide_get_extent(collider: &Collider, origin: Vec3, rotation: Quat, dir: Di
// This should not be necessary, but it seems like a parry
// bug sometimes causes the hit to be `None` even though that should
// be impossible: https://discord.com/channels/691052431525675048/1124043933886976171/1275214643341561970
const ARBITRARY_Z_ROTATION: f32 = 5e-4;
const ARBITRARY_ROTATION: f32 = 5e-3;
for offset in [
0.,
ARBITRARY_Z_ROTATION,
-ARBITRARY_Z_ROTATION,
2.0 * ARBITRARY_Z_ROTATION,
-2.0 * ARBITRARY_Z_ROTATION,
Quat::IDENTITY,
Quat::from_rotation_x(ARBITRARY_ROTATION),
Quat::from_rotation_x(-ARBITRARY_ROTATION),
Quat::from_rotation_y(ARBITRARY_ROTATION),
Quat::from_rotation_y(-ARBITRARY_ROTATION),
Quat::from_rotation_z(ARBITRARY_ROTATION),
Quat::from_rotation_z(-ARBITRARY_ROTATION),
] {
let rotation = rotation * Quat::from_rotation_z(offset);
let rotation = rotation * offset;
let hit = collider.cast_ray(TRANSLATION, rotation, origin, dir.into(), MAX_TOI, SOLID);
if let Some((toi, _normal)) = hit {
return toi;
Expand Down

0 comments on commit 25e2c9b

Please sign in to comment.