mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
physics-related fixes
This commit is contained in:
parent
47c6e35a0b
commit
997cff04d1
2 changed files with 14 additions and 11 deletions
|
|
@ -35,9 +35,10 @@ Player::~Player() {
|
|||
}
|
||||
|
||||
void Player::updateInput(
|
||||
Level* level,
|
||||
PlayerInput& input,
|
||||
float delta) {
|
||||
Level* level,
|
||||
PlayerInput& input,
|
||||
float delta
|
||||
) {
|
||||
bool crouch = input.shift && hitbox->grounded && !input.sprint;
|
||||
float speed = this->speed;
|
||||
if (flight){
|
||||
|
|
@ -76,9 +77,9 @@ void Player::updateInput(
|
|||
hitbox->velocity.z += dir.z * speed * delta * 9;
|
||||
}
|
||||
|
||||
float vel = std::max(glm::length(hitbox->velocity * 0.25f), 1.0f);
|
||||
int substeps = int(delta * vel * 1000);
|
||||
substeps = std::min(100, std::max(1, substeps));
|
||||
float vel = glm::length(hitbox->velocity);
|
||||
int substeps = int(delta * vel * 20);
|
||||
substeps = std::min(100, std::max(2, substeps));
|
||||
level->physics->step(
|
||||
level->chunks.get(),
|
||||
hitbox.get(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue