Don't set the player to previous position when uncrouching.

This commit is contained in:
William Moberg
2016-03-09 17:51:26 +01:00
parent 4ae39dcc36
commit 9581e9ac84
5 changed files with 21 additions and 2 deletions
@@ -273,6 +273,15 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
size = glm::vec3(1.f, 1.f, 1.f);
} else {
size = glm::vec3(1.f, 1.6f, 1.f);
if (controller->CrouchingLastFrame() && player.HasComponent("Collidable")) {
// Disable jitter guard so player doesn't get stuck in the ground.
(bool&)player["Collidable"]["JitterGuard"] = false;
if (isOnGround) {
// The collision should resolve this anyway, but
// this is more reliable, since the box gets larger.
((glm::vec3&)cTransform["Position"]).y += 0.3f;
}
}
}
}