gravity
This commit is contained in:
parent
ab950a8091
commit
18f6aff1d2
4
app.js
4
app.js
@ -205,6 +205,9 @@ class NextQueue extends THREE.Group {
|
||||
}
|
||||
NextQueue.prototype.positions = [P(0, 0, 0), P(0, -4, 0), P(0, -8, 0), P(0, -12, 0), P(0, -16, 0)]
|
||||
|
||||
|
||||
const GRAVITY = -20
|
||||
|
||||
class Mino extends THREE.Mesh {
|
||||
constructor() {
|
||||
super(Mino.prototype.geometry)
|
||||
@ -215,6 +218,7 @@ class Mino extends THREE.Mesh {
|
||||
}
|
||||
|
||||
update(delta) {
|
||||
this.velocity.y += delta * GRAVITY
|
||||
this.position.addScaledVector(this.velocity, delta)
|
||||
this.rotateOnWorldAxis(this.rotationAngle, delta*this.angularVelocity)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user