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).
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 {
None => {
vel.0.z -= dt.0 * GRAVITY;
@ -682,7 +687,7 @@ impl<'a> PhysicsData<'a> {
density,
mass,
&fluid,
GRAVITY,
custom_gravity.unwrap_or(GRAVITY),
);
},
}