mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Remove eye height check for beam
This commit is contained in:
parent
695f6c52fe
commit
456ceab6d0
@ -68,11 +68,10 @@ impl<'a> System<'a> for Sys {
|
||||
&read_data.entities,
|
||||
&read_data.positions,
|
||||
&read_data.orientations,
|
||||
read_data.bodies.maybe(),
|
||||
&beam_segments,
|
||||
)
|
||||
.par_join()
|
||||
.fold(|| (Vec::new(), Vec::new()), |(mut server_events, mut add_hit_entities), (entity, pos, ori, body, beam_segment)|
|
||||
.fold(|| (Vec::new(), Vec::new()), |(mut server_events, mut add_hit_entities), (entity, pos, ori, beam_segment)|
|
||||
{
|
||||
let creation_time = match beam_segment.creation {
|
||||
Some(time) => time,
|
||||
@ -116,8 +115,6 @@ impl<'a> System<'a> for Sys {
|
||||
return (server_events, add_hit_entities);
|
||||
};
|
||||
|
||||
let eye_pos = pos.0 + Vec3::unit_z() * body.map_or(0.0, |b| b.eye_height());
|
||||
|
||||
// Go through all other effectable entities
|
||||
for (target, uid_b, pos_b, health_b, body_b) in (
|
||||
&read_data.entities,
|
||||
@ -142,13 +139,13 @@ impl<'a> System<'a> for Sys {
|
||||
let hit = entity != target
|
||||
&& !health_b.is_dead
|
||||
// Collision shapes
|
||||
&& sphere_wedge_cylinder_collision(eye_pos, frame_start_dist, frame_end_dist, *ori.look_dir(), beam_segment.angle, pos_b.0, rad_b, height_b);
|
||||
&& sphere_wedge_cylinder_collision(pos.0, frame_start_dist, frame_end_dist, *ori.look_dir(), beam_segment.angle, pos_b.0, rad_b, height_b);
|
||||
|
||||
// Finally, ensure that a hit has actually occurred by performing a raycast. We do this last because
|
||||
// it's likely to be the most expensive operation.
|
||||
let tgt_dist = eye_pos.distance(pos_b.0);
|
||||
let tgt_dist = pos.0.distance(pos_b.0);
|
||||
let hit = hit && read_data.terrain
|
||||
.ray(eye_pos, eye_pos + *ori.look_dir() * (tgt_dist + 1.0))
|
||||
.ray(pos.0, pos.0 + *ori.look_dir() * (tgt_dist + 1.0))
|
||||
.until(|b| b.is_filled())
|
||||
.cast().0 >= tgt_dist;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user