mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
physics substeps calculation fix
This commit is contained in:
parent
2ba9125804
commit
00db63723a
1 changed files with 4 additions and 2 deletions
|
|
@ -69,12 +69,14 @@ void Player::update(
|
||||||
hitbox->velocity.z += dir.z * speed * delta * 9;
|
hitbox->velocity.z += dir.z * speed * delta * 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
int substeps = (int)(delta * 1000);
|
float vel = std::max(glm::length(hitbox->velocity * 0.25f), 1.0f);
|
||||||
substeps = std::min(100, std::max(0, substeps));
|
int substeps = int(delta * vel * 1000);
|
||||||
|
substeps = std::min(100, std::max(1, substeps));
|
||||||
level->physics->step(level->chunks, hitbox,
|
level->physics->step(level->chunks, hitbox,
|
||||||
delta, substeps,
|
delta, substeps,
|
||||||
crouch, flight ? 0.0f : 1.0f,
|
crouch, flight ? 0.0f : 1.0f,
|
||||||
!noclip);
|
!noclip);
|
||||||
|
|
||||||
if (flight && hitbox->grounded) {
|
if (flight && hitbox->grounded) {
|
||||||
flight = false;
|
flight = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue