Controller support

I believe controller support can be done with just two behaviors, this is a description of each.

Joystick- It would be a trigger, and would work somewhat similar to keyboard, and would have to be set like one. (Like pressing a button on the keyboard to assign a key to the behavior)

It would have 2 outputs: Rot and Tilt.
Rot outputs from 1-360, and is based on the direction on which you tilt the stick, while Tilt outputs from 0-100, based on how much its tilted.

If you wanted to make the highest you could get with tilt a number, pair it with an expression. (In SB3s case, the max speed is 8, so youd multiply the thing by .08, so when the joystick is completely tilted, it would be converted to just 8.

Button: again set like keyboard, and could probably be replaced by keyboard if we really wanted. Note that some joysticks on controllers can be pressed inwards so that should be counted as a button as well.

Check- will output a 0 or a 1 at the beginning of the level, based off if a controller is plugged in or not, can also be inputted manually and will not automatically do so if connected to an output. (Like how a timer will output if nothing is connected to its start)

@grazer

It could probably be placed in its own category, but triggers if not…

i likey idea

Grazer

Hey, I think it would probably be better to try and capture the entire controller state of one controller using a single block. (Another thing to consider is that you can have more than one).

Maybe the “Controller” block would just be a trigger that has outputs for:

  • connected (outputs the controller id)
  • disconnected (same)
  • joystick x pos
  • joystick y pos
  • button one pressed
  • button two pressed
  • etc

That would make the block itself pretty large - maybe there just should be a “button pressed” output that outputs the button number - this means it would need to get filtered, but there would be an unlimited number of buttons.

What do you think?

Different, but that was fairly similar to what Mhx said, so I imagine it would work better.

Would the think be settable so only the first controller plugged in could use that node, and the 2nd player could only use another?

Multiplayer would work really well.

The Trello card for this feature is here: https://trello.com/c/XWgcJEEI/49-controller-support

I thought that the button pressed feature would be good, because honestly it doesn’t matter what number on the joystick the button is, you can reprogram it. However, interesting thought, sense controllers use numbers 1 through 15 I believe, I don’t think I’ve seen a controller with more than 15 buns, there should be an input on the behavior that allows you to change the number of the controller input number button, so then people can customize their controllers with numbers in game. Those numbers could be saved with the safe behavior, and automatically load their preset controller configurations. As for toggle sticks, you can have them measure XYZ (up down left right and click) or whatever you have them do, and also output numbers for radius and distance.