mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Resolves #1977: Vernier gdxfor extension falling? reports true while hardware disconnected.
This commit is contained in:
parent
9dd8e9398a
commit
a68886cee9
1 changed files with 7 additions and 0 deletions
|
@ -822,6 +822,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