WIP crisper camera controls (fix scaling of engine parameters)

This commit is contained in:
yuni 2024-11-16 23:12:47 +01:00
parent 8fcb702623
commit 86999574d1

View file

@ -728,7 +728,8 @@ fn handle_wants_acceleration(
settings: Res<var::Settings>,
jupiter_pos: Res<game::JupiterPos>,
q_audiosinks: Query<(&audio::Sfx, &AudioSink)>,
mut q_actor: Query<(
mut q_actor: Query<
(
Entity,
&Transform,
&Position,
@ -737,7 +738,9 @@ fn handle_wants_acceleration(
Option<&WantsAcceleration>,
Option<&hud::IsTargeted>,
Option<&PlayerCamera>,
), Without<visual::IsEffect>>,
),
Without<visual::IsEffect>,
>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
) {
let dt = time.delta_seconds();
@ -818,19 +821,20 @@ fn handle_wants_acceleration(
(engine.current_warmup + dt / engine.warmup_seconds).clamp(0.0, 1.0);
// Adjust acceleration to what the engine can actually provide
let forward_factor = engine.current_warmup
* (if accel.direction.z > 0.0 {
let factor_forward = if accel.direction.z > 0.0 {
engine.thrust_forward
} else {
engine.thrust_back
});
let right_factor = engine.thrust_sideways * engine.current_warmup;
let up_factor = engine.thrust_sideways * engine.current_warmup;
let factor =
DVec3::new(right_factor as f64, up_factor as f64, forward_factor as f64);
};
let factor_right = engine.thrust_sideways;
let factor_up = engine.thrust_sideways;
let engine_factor = Vec3::new(factor_forward, factor_up, factor_right).as_dvec3()
* engine.current_warmup as f64
* ENGINE_SPEED_FACTOR as f64
* engine.current_boost_factor;
// Apply acceleration to velocity
**v += delta_v * factor;
**v += delta_v * engine_factor * dt as f64;
// Visual effect
if engine.engine_type == EngineType::Monopropellant {