Browse Source

Basketball game: fix

customisations
alemart 8 months ago
parent
commit
df2ba098e4
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      demos/basketball/src/entities/ball.js

+ 1
- 1
demos/basketball/src/entities/ball.js View File

@@ -149,6 +149,7 @@ export class Ball extends Entity
149 149
 
150 150
             if(position.x > 60) {
151 151
                 impostor.mass = 1; // enable gravity
152
+                this._positionWhenThrown.copyFrom(mesh.absolutePosition);
152 153
                 this._state = 'throwing';
153 154
             }
154 155
         }
@@ -209,7 +210,6 @@ export class Ball extends Entity
209 210
             -magnitude * Math.cos(SHOOT_ANGLE)
210 211
         );
211 212
 
212
-        this._positionWhenThrown.copyFrom(this._mesh.absolutePosition);
213 213
         this._mesh.physicsImpostor.applyImpulse(impulse, this._mesh.absolutePosition);
214 214
         this._state = 'thrown';
215 215
     }

Loading…
Cancel
Save