Gamepad library

It's I decided to make a library that adds the ability to use a gamepad (or controller) in snap.

Features:

Here's the list of blocks

untitled script pic

The gamepads reporter reports the gamepads that it detects. It may not detect the gamepads the first time you run it, but it should the next time.

I created the pov dpad () block because I have a controller that uses an axis for the dpad, and that was the only way I could detect the direction I pressed.

clamp is to normalize joysticks.

deadzone makes an axis (or list of axes) have a deadzone, as well as (hopefully) smooth it.

Yes, the last 3 blocks don't use js.

Here's where I got my info from Using Gamepads and Joysticks in JavaScript

Edit: woops, forgot the project link
https://snap.berkeley.edu/snap/snap.html#present:Username=ego-lay_atman-bay&ProjectName=gamepad

Cool library, and impressive. What's the purpose of the
untitled script pic (14)
block?

I don't get what

means.

It's to make all joy sticks be in a circle, because some joysticks can go outside the regular area for a joystick.

update: I fixed a few blocks

well, here's a video showing why we need clamping, and what it is.

nice!

Ahh okay. Are you using a gamecube controller because the octagon track of the joystick looks like one. Also I didn't know you make Mariokart content.

The controller I'm using is a nintendo switch usb controller. I don't know why it's like that, but it is.

off-topic

yes, most of my content is mario kart tour. Since I play it every day, I'm able to make videos of it.

Update: made the deadzone block way better.