Fixed throwing problems with 2+ pointers

This commit is contained in:
2019-05-31 09:51:01 +02:00
parent d114edc1e2
commit d0d3a7f134
2 changed files with 17 additions and 4 deletions
+3 -1
View File
@@ -127,7 +127,9 @@ class Throwable {
this.lastframe = t
if (dt > 0) {
// Avoid division by zero errors later on
let velocity = { t: t, dt: dt, dx: delta.x, dy: delta.y }
// and consider the number of involved pointers sind addVelocity will be called by the
// onMove events
let velocity = { t: t, dt: dt, dx: delta.x / delta.number, dy: delta.y / delta.number}
this.velocities.push(velocity)
while (this.velocities.length > buffer) {
this.velocities.shift()