Hack custom gravity of 1G while gliding

This commit is contained in:
Ludvig Böklin 2021-06-08 14:01:19 +02:00
parent dade686fbd
commit c2b4f926c1

View File

@ -668,6 +668,11 @@ impl<'a> PhysicsData<'a> {
// to lag (as observed in the 0.9 release party). // to lag (as observed in the 0.9 release party).
let dt = DeltaTime(read.dt.0.min(0.1)); let dt = DeltaTime(read.dt.0.min(0.1));
// Hack. FIXME: Implement gravity magic proper and/or set GRAVITY to 9.81.
let custom_gravity = character_state.and_then(|cs| match cs {
CharacterState::Glide(_) => Some(9.81),
_ => None,
});
match physics_state.in_fluid { match physics_state.in_fluid {
None => { None => {
vel.0.z -= dt.0 * GRAVITY; vel.0.z -= dt.0 * GRAVITY;
@ -682,7 +687,7 @@ impl<'a> PhysicsData<'a> {
density, density,
mass, mass,
&fluid, &fluid,
GRAVITY, custom_gravity.unwrap_or(GRAVITY),
); );
}, },
} }