Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A sensor extension #1431

Open
DNin01 opened this issue Apr 30, 2024 · 5 comments
Open

A sensor extension #1431

DNin01 opened this issue Apr 30, 2024 · 5 comments

Comments

@DNin01
Copy link
Collaborator

DNin01 commented Apr 30, 2024

Sometimes you want to make games or interactive elements that respond to input other than mouse, keyboard, or touch, and for this, it could be really cool to have an extension that can read various sensors of the device, such as the accelerometer or gyroscope.

We could implement anything that is offered by the Sensor APIs.

Sensing Plus has a block to get accelerometer/gyroscope data but it also has a bunch of other blocks that I don't necessarily want to have to import along. Plus, a dedicated extension would probably be programmed better as sensor access would be the whole point of it.

@DNin01
Copy link
Collaborator Author

DNin01 commented May 2, 2024

We could also use device orientation events, which are more widely supported.

Keep in mind that the behavior may differ between browsers.

Note that Safari for macOS supports these APIs since version 17, but Safari for iOS has supported them since version 4.2, released in 2010. On that note, seeing that people are probably going to be making mostly mobile games in TurboWarp that utilize these features, we may not even want a motion sensing extension to work on computers.

@DNin01
Copy link
Collaborator Author

DNin01 commented May 5, 2024

Some of you developers might like to try https://sensor-js.xyz/demo.html on your mobile devices to test out the features.

@Xeltalliv
Copy link
Contributor

I made this https://github.com/Xeltalliv/extensions/blob/generic-sensors/extensions/Vadik1/generic-sensors.js over a year ago, but haven't submitted to any extension gallery

@JuanJose2325
Copy link

Hi, I don't know if I should post this here, but I'm having trouble getting the values for the gyroscope and accelerometer sensors with the sensing+ extension and the generic sensors extension that was posted here.
However, in https://sensor-js.xyz/demo.html I am getting the values, I have already tested on two phones.

@DNin01
Copy link
Collaborator Author

DNin01 commented Jan 6, 2025

Hi, I don't know if I should post this here, but I'm having trouble getting the values for the gyroscope and accelerometer sensors with the sensing+ extension and the generic sensors extension that was posted here. However, in https://sensor-js.xyz/demo.html I am getting the values, I have already tested on two phones.

Yeah, Sensing+ implements it in a finicky way, I guess. That's the nature of trying to do so many things in the same extension...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants