Merge branch 'sam/fix-arrow-terrain-bug' into 'master'

Arrows no longer deal damage seconds after colliding with terrain

See merge request veloren/veloren!2786
This commit is contained in:
Samuel Keiffer 2021-08-28 23:11:50 +00:00
commit fc77cd6256

View File

@ -401,7 +401,7 @@ impl<'a> PhysicsData<'a> {
.ceil()
as usize;
let step_delta = 1.0 / increments as f32;
let mut collided = false;
let mut collision_registered = false;
for i in 0..increments {
let factor = i as f32 * step_delta;
@ -419,7 +419,10 @@ impl<'a> PhysicsData<'a> {
<= pos_other.z
+ z_limits_other.1 * previous_cache_other.scale
{
if !collided {
// If entities have not yet collided this tick (but just
// did) and if entity is either in mid air or is not sticky,
// then mark them as colliding with the other entity
if !collision_registered && (is_mid_air || !is_sticky) {
physics.touch_entities.insert(*other);
entity_entity_collisions += 1;
}
@ -472,7 +475,7 @@ impl<'a> PhysicsData<'a> {
Vec3::from(diff.normalized()) * force * step_delta;
}
collided = true;
collision_registered = true;
}
}
},