Major new version #2

Merged
LeoVasanko merged 86 commits from vol002 into main 2025-08-26 05:58:24 +01:00
Showing only changes of commit 2f69e7bd88 - Show all commits

View File

@ -96,13 +96,14 @@ function createMomentumDrag({
} catch {}
}
usingPointerLock = false
velocity = 0
if (samples.length) {
const first = samples[0]
const now = performance.now()
const last = samples[samples.length - 1]
const dy = last.position - first.position
velocity = (-dy * speed) / (now - first.timestamp)
} else velocity = 0
if (Math.abs(dy) > 5) velocity = (-dy * speed) / (now - first.timestamp)
}
console.log(velocity, samples)
samples = []
startMomentum()