Remove redundant 'pos' variable

This commit is contained in:
Dr. Dystopia 2022-03-05 09:54:01 +01:00
parent 1cb7a083e7
commit 1810998641

View File

@ -2273,11 +2273,11 @@ impl<'a> AgentData<'a> {
path: Path, path: Path,
speed_multiplier: Option<f32>, speed_multiplier: Option<f32>,
) -> bool { ) -> bool {
let pos = self.pos.0;
let partial_path_tgt_pos = |pos_difference: Vec3<f32>| { let partial_path_tgt_pos = |pos_difference: Vec3<f32>| {
pos + PARTIAL_PATH_DIST * pos_difference.try_normalized().unwrap_or_else(Vec3::zero) self.pos.0
+ PARTIAL_PATH_DIST * pos_difference.try_normalized().unwrap_or_else(Vec3::zero)
}; };
let pos_difference = tgt_pos - pos; let pos_difference = tgt_pos - self.pos.0;
let pathing_pos = match path { let pathing_pos = match path {
Path::Separate => { Path::Separate => {
let mut sep_vec: Vec3<f32> = Vec3::<f32>::zero(); let mut sep_vec: Vec3<f32> = Vec3::<f32>::zero();
@ -2285,7 +2285,7 @@ impl<'a> AgentData<'a> {
for entity in read_data for entity in read_data
.cached_spatial_grid .cached_spatial_grid
.0 .0
.in_circle_aabr(pos.xy(), SEPARATION_DIST) .in_circle_aabr(self.pos.0.xy(), SEPARATION_DIST)
{ {
if let (Some(alignment), Some(other_alignment)) = if let (Some(alignment), Some(other_alignment)) =
(self.alignment, read_data.alignments.get(entity)) (self.alignment, read_data.alignments.get(entity))
@ -2317,7 +2317,7 @@ impl<'a> AgentData<'a> {
let speed_multiplier = speed_multiplier.unwrap_or(1.0).min(1.0); let speed_multiplier = speed_multiplier.unwrap_or(1.0).min(1.0);
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
&*read_data.terrain, &*read_data.terrain,
pos, self.pos.0,
self.vel.0, self.vel.0,
pathing_pos, pathing_pos,
TraversalConfig { TraversalConfig {