Controller motion sensor cursor

I’m trying to make a cursor controlled by the motion sensor of the controller, similar to the wii controller (3DoF). The thing is, I dunno how to do that. Can anyone help on making something like that?

There are device expressions to get this motion data: Expressions reference [GDevelop wiki]
Actions to use them:
And example projects demonstrating them:

But that’s for the device sensors. External controllers may not work out of the box.

is there any way to implement this in javascript using the current PS3/XBOX360 drivers?

No, because the API / drivers behind these controllers don’t share the orientation to the PC.
As far I know the no one already used a wii controller either.

will it be ever added? It is possible if the controller has a gyroscope and accelerometer like a VR Controller or PS4 Controller.

Just to clarify, you’d have to ask whomever makes the base GamePad APIs. This isn’t a GDevelop thing, it’s custom driver functionality and web API thing. GDevelop doesn’t have base level access to your system drivers, it has whatever access to what is normally available via Web APIs.

Oculus controllers work because they have specific backend application to receive data from the headset and controllers (which constantly runs on your PC), it’s not a base part of how Windows deals with gamepads.

isn’t arthuro555 the one that made the controller extension? I am blocked by him so I can’t really message him.

No, he didn’t. Bouh did, and he explicitly gave you an answer above.

And the controller extension is just embedding the GamePad Web API, which I just explained about above.

If GDevelop uses JavaScript, Why not implement an API for better controller support? (might fix the controller button released but as well). And it might be available for physical apps only (no HTML).

As you said, GDevelop uses Javascript. With that in mind you are welcome to adapt whatever API or libraries you want, and even release it as an extension if you want.

The existing Gamepad extension uses an established and widely supported Gamepad API, which is the standard in regards to Electron (what is used to bundling GDevelop games) and gamepads. It supports 99% of gamepad configurations. I don’t see it being likely that there’s any official efforts going beyond that anytime soon.

From a quick search on github, there are no results for gamepad gyro in Javascript, nor motion controls. The closest 3DOF library hasn’t been updated in 3 years and isn’t even fully functional, so I’m not sure that there’s an existing library to adapt regardless.

1 Like

In that case, how do you adapt an API to GDevelop?

Build or fully understand a javascript library that contains the API.
Create an extension that exposes each API call or action as an event by setting up your own actions/conditions/expressions, then in their actual event logic you add Javascript events with the code you’ve built.

Also why do javascript events tend to crash the game?

That’s really not related to this thread, but also not accurate as far as I know.

Poorly structured/formatted Javascript code in a event would crash the game, but seeing as many major extensions that are used regularly by thousands of users (e.g. Gamepad) are javascript events based, there doesn’t seem to be any widespread issues with Javascript events themselves.

1 Like