ghjfdhgdjgfdgjh

This commit is contained in:
yuni 2024-11-17 02:12:58 +01:00
parent d4c8ca231a
commit 14991879c9

View file

@ -57,6 +57,7 @@ impl Plugin for ActorPlugin {
.after(sync::position_to_transform), .after(sync::position_to_transform),
handle_gforce handle_gforce
.run_if(game_running) .run_if(game_running)
.run_if(alive)
.after(PhysicsSet::Sync) .after(PhysicsSet::Sync)
.after(sync::position_to_transform) .after(sync::position_to_transform)
.after(handle_wants_acceleration), .after(handle_wants_acceleration),
@ -870,6 +871,8 @@ fn handle_wants_acceleration(
engine.current_warmup = engine.current_warmup =
(engine.current_warmup + dt / engine.warmup_seconds).clamp(0.0, 1.0); (engine.current_warmup + dt / engine.warmup_seconds).clamp(0.0, 1.0);
delta_v = delta_v.clamp(DVec3::splat(-1.0), DVec3::splat(1.0));
// Adjust acceleration to what the engine can actually provide // Adjust acceleration to what the engine can actually provide
let factor_forward = if accel.direction.z > 0.0 { let factor_forward = if accel.direction.z > 0.0 {
engine.thrust_forward engine.thrust_forward
@ -883,10 +886,8 @@ fn handle_wants_acceleration(
* ENGINE_SPEED_FACTOR as f64 * ENGINE_SPEED_FACTOR as f64
* engine.current_boost_factor; * engine.current_boost_factor;
let final_accel = (trans.rotation let final_accel =
* (delta_v.clamp_length_max(1.0) * engine_factor).as_vec3() (trans.rotation * (delta_v * engine_factor).as_vec3() * dt).as_dvec3();
* dt)
.as_dvec3();
// Apply acceleration to velocity // Apply acceleration to velocity
if allow_fullstop { if allow_fullstop {