Skip to content

Commit 8567f6e

Browse files
committed
Fix for falling through world on focus change
1 parent 8081055 commit 8567f6e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

public/mouseKeyboardControl.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ function positionChanged() {
128128
* Call this once per frame when using non-VR.
129129
* @param {number} dt Seconds elapsed since the last control update.
130130
*/
131-
function updateControls(dt) {
131+
function updateControls(dt) {
132+
// Enforce a maximum time step to avoid falling through floor when out of focus.
133+
dt = Math.min(dt, 0.1);
132134

133135
// Get the horizontal rotation of the orbit perspective, between -PI and +PI.
134136
const angle = orbit.getAzimuthalAngle();

0 commit comments

Comments
 (0)