Skip to content

Commit 5adf19d

Browse files
committed
[player] delay falling switch to prevent jitter
1 parent 67f63c6 commit 5adf19d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/website/verse/Player.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,15 @@ export class Player extends Entity {
581581
this.jumping = true
582582
}
583583

584-
// if not grounded and our velocity is downward, progress to falling
584+
// if not grounded and our velocity is downward, start timing our falling
585585
if (!this.grounded && this.actor.getLinearVelocity().y < 0) {
586+
this.fallTimer += delta
587+
} else {
588+
this.fallTimer = 0
589+
}
590+
// if we've been falling for a bit then progress to actual falling
591+
// this is to prevent animation jitter when only falling for a very small amount of time
592+
if (this.fallTimer > 0.1) {
586593
this.jumping = false
587594
this.falling = true
588595
}

0 commit comments

Comments
 (0)