SkyRace targets fly towards you (to simulate stationary targets on a road)
This commit is contained in:
parent
4aaea769fb
commit
e5a2a46f7a
18
src/game.rs
18
src/game.rs
|
@ -795,16 +795,16 @@ fn handle_race(
|
|||
if race.score >= RACE_SCORE_ACHIEVEMENT as f64 {
|
||||
ew_achievement.send(game::AchievementEvent::RaceScore);
|
||||
}
|
||||
let difficulty = 2.0 * race.score as f64;
|
||||
let mut delta = DVec3::new(0.0, 0.0, 100.0);
|
||||
delta = (player_trans.rotation * delta.as_vec3()).as_dvec3();
|
||||
delta += DVec3::new(
|
||||
(fastrand::f64() - 0.5) * difficulty,
|
||||
(fastrand::f64() - 0.5) * difficulty,
|
||||
(fastrand::f64() - 0.5) * difficulty,
|
||||
let difficulty = 2.0 * race.score as f32;
|
||||
let ring_slowdown = player_trans.rotation * (Vec3::Z * (-25.0 - difficulty));
|
||||
let mut delta = player_trans.rotation * (Vec3::Z * 100.0);
|
||||
delta += Vec3::new(
|
||||
(fastrand::f32() - 0.5) * difficulty,
|
||||
(fastrand::f32() - 0.5) * difficulty,
|
||||
(fastrand::f32() - 0.5) * difficulty,
|
||||
);
|
||||
*target_pos = Position(player_pos.0 + delta);
|
||||
*target_v = *player_v;
|
||||
target_pos.0 = player_pos.0 + delta.as_dvec3();
|
||||
target_v.0 = player_v.0 + ring_slowdown.as_dvec3();
|
||||
*target_vis = Visibility::Inherited;
|
||||
commands.entity(target_entity).insert(RigidBody::Kinematic);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue