Skip to content

Commit

Permalink
Fix for falling through world on focus change
Browse files Browse the repository at this point in the history
  • Loading branch information
DMGregory committed Nov 16, 2021
1 parent 8081055 commit 8567f6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/mouseKeyboardControl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ function positionChanged() {
* Call this once per frame when using non-VR.
* @param {number} dt Seconds elapsed since the last control update.
*/
function updateControls(dt) {
function updateControls(dt) {
// Enforce a maximum time step to avoid falling through floor when out of focus.
dt = Math.min(dt, 0.1);

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

0 comments on commit 8567f6e

Please sign in to comment.