Only trigger stuck detection when against map obstruction.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nolan Darilek 2023-04-04 13:00:00 -05:00
parent ea881c0607
commit 880e79eb8d

View File

@ -280,6 +280,7 @@ fn negotiate_path(
Option<&RotationSpeed>, Option<&RotationSpeed>,
)>, )>,
rapier_context: Res<RapierContext>, rapier_context: Res<RapierContext>,
obstructions: Query<&MapObstruction>,
) { ) {
for (entity, mut actions, mut path, mut transform, collider, rotation_speed) in &mut query { for (entity, mut actions, mut path, mut transform, collider, rotation_speed) in &mut query {
let start_i32 = transform.translation.truncate().i32(); let start_i32 = transform.translation.truncate().i32();
@ -326,10 +327,11 @@ fn negotiate_path(
collider, collider,
rapier_context.integration_parameters.dt, rapier_context.integration_parameters.dt,
QueryFilter::new() QueryFilter::new()
.predicate(&|entity| obstructions.get(entity).is_ok())
.exclude_sensors() .exclude_sensors()
.exclude_collider(entity), .exclude_collider(entity),
) { ) {
trace!("{entity:?} is stuck, hit: {hit:?}, TOI: {toi:?}"); println!("{entity:?} is stuck, hit: {hit:?}, TOI: {toi:?}");
// TODO: Remove when we have an actual character controller. // TODO: Remove when we have an actual character controller.
transform.translation = next.extend(0.); transform.translation = next.extend(0.);
continue; continue;