mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-13 23:10:56 -04: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 () {
|
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 accelMag = this.accelMagnitude();
|
||||||
const spinMag = this.spinMagnitude();
|
const spinMag = this.spinMagnitude();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue