Add comment to physics and replace magic number in climbing boost with a named constant, fixes #1002

This commit is contained in:
Imbris 2021-07-29 03:08:43 -04:00
parent 680492cea6
commit 01d1089a46
2 changed files with 8 additions and 3 deletions

View File

@ -68,10 +68,13 @@ impl CharacterBehavior for Data {
.then(|| data.body.jump_impulse()) .then(|| data.body.jump_impulse())
.flatten() .flatten()
{ {
// How strong the climb boost is relative to a normal jump
const CLIMB_BOOST_JUMP_FACTOR: f32 = 0.5;
// They've climbed atop something, give them a boost // They've climbed atop something, give them a boost
update update.local_events.push_front(LocalEvent::Jump(
.local_events data.entity,
.push_front(LocalEvent::Jump(data.entity, 0.5 * impulse / data.mass.0)); CLIMB_BOOST_JUMP_FACTOR * impulse / data.mass.0,
));
}; };
update.character = CharacterState::Idle {}; update.character = CharacterState::Idle {};
return update; return update;

View File

@ -668,6 +668,8 @@ impl<'a> PhysicsData<'a> {
) )
.join() .join()
{ {
// Note: updating ori with the rest of the cache values above was attempted but
// it did not work (investigate root cause?)
previous_phys_cache.ori = ori.to_quat(); previous_phys_cache.ori = ori.to_quat();
} }
drop(guard); drop(guard);