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())
.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
update
.local_events
.push_front(LocalEvent::Jump(data.entity, 0.5 * impulse / data.mass.0));
update.local_events.push_front(LocalEvent::Jump(
data.entity,
CLIMB_BOOST_JUMP_FACTOR * impulse / data.mass.0,
));
};
update.character = CharacterState::Idle {};
return update;

View File

@ -668,6 +668,8 @@ impl<'a> PhysicsData<'a> {
)
.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();
}
drop(guard);