mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
update substeps calculation scheme
This commit is contained in:
parent
262e72c36e
commit
f726702f21
1 changed files with 1 additions and 2 deletions
|
|
@ -281,7 +281,6 @@ void Entities::preparePhysics(float delta) {
|
|||
auto& physics = *level.physics;
|
||||
auto& solidHitboxes = physics.getSolidHitboxesWriteable();
|
||||
|
||||
|
||||
if (sensorsTickClock.update(delta)) {
|
||||
auto part = sensorsTickClock.getPart();
|
||||
auto parts = sensorsTickClock.getParts();
|
||||
|
|
@ -330,7 +329,7 @@ void Entities::updatePhysics(float delta) {
|
|||
bool grounded = hitbox.grounded;
|
||||
|
||||
float vel = glm::length(prevVel);
|
||||
int substeps = static_cast<int>(delta * vel * 20);
|
||||
int substeps = static_cast<int>(delta * (vel + 2.0f) * 20);
|
||||
substeps = std::min(100, std::max(2, substeps));
|
||||
physics->step(*level.chunks, hitbox, delta, substeps, eid.uid);
|
||||
hitbox.friction = glm::abs(hitbox.gravityScale <= 1e-7f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue