mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Merge pull request #1986 from evhan55/bug/gdxfor-falling
Vernier gdxfor "falling?" report false when not connected
This commit is contained in:
commit
16ebcb82b2
1 changed files with 7 additions and 0 deletions
|
@ -827,6 +827,13 @@ class Scratch3GdxForBlocks {
|
|||
}
|
||||
|
||||
isFreeFalling () {
|
||||
// When the peripheral is not connected, the acceleration magnitude
|
||||
// is 0 instead of ~9.8, which ends up calculating as a positive
|
||||
// free fall; so we need to return 'false' here to prevent returning 'true'.
|
||||
if (!this._peripheral.isConnected()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const accelMag = this.accelMagnitude();
|
||||
const spinMag = this.spinMagnitude();
|
||||
|
||||
|
|
Loading…
Reference in a new issue