diff --git a/src/actor.rs b/src/actor.rs index 755fd0d..c5e98a3 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -555,18 +555,12 @@ fn handle_wants_maxvelocity( &WantsMaxVelocity, Option<&OrbitsJupiter>, )>, - id2pos: Res, + jupiter_pos: Res, ) { let dt = time.delta_seconds(); - let jupiter_pos: DVec3 = if let Some(jupiter_pos) = id2pos.0.get(cmd::ID_JUPITER) { - *jupiter_pos - } else { - warn!("Could not determine Jupiter's position"); - DVec3::ZERO - }; for (pos, mut v, engine, maxv, orbits_jupiter) in &mut query { let target_velocity = if orbits_jupiter.is_some() { - let relative_pos = pos.0 - jupiter_pos; + let relative_pos = pos.0 - jupiter_pos.0; nature::orbital_velocity(relative_pos, nature::JUPITER_MASS) } else { DVec3::ZERO @@ -672,21 +666,15 @@ fn handle_gravity( time: Res