Control pad brick use

Hi,

I would to know how does the control pad brick work, it uses python code for it to work. I would like to know if I can try this, I have a control pad, USB one, they are all like that, so I just want to see if can work with this brick.

While my projects didn’t work out to change them further, I am just trying to see if I can add may be a control feature.:slightly_smiling_face:

If I remember, a PS3 one works with the blender game engine and the xbox 360 but they are hassle to work. I never tried the feature.

I’d need a copy of a template code to try this. I use 2.76

https://docs.blender.org/api/blender_python_api_2_65_9/bge.types.html#bge.types.SCA_JoystickSensor

This contains reference to a joy stick control.

its old and outdated, but its still a fantastic example of how to make a working xbox360 controller, and any other joystick or gamepad.

Why is out of date? Blender doesn’t really have games that used pads, if anything it seems unused, I at least have that impression.

So I guess I can get a few direction buttons on a USB pad to move an object around?

for one, that repository has a pretty good wiki and it has a keymap gui you can use to auto detect buttons and axis.

i stopped updating it after i created the game3 template which has a similar inputs system.

I’m going to need some hints with this, so I copy what code exactly?

in the Extras folder, there a test.blend which should be a simple example of how to use it.

this is a full python solution, but if you get creative, you can find a way to make it work with logic bricks.

I see, the mouse can rotate an object. In this case, I’d want to get some buttons on the USB pad to move it around.

i gave you an example how to get states from the bind.

heres some more info:

Right I’ve seen that page, I got the files from there.

< Blockquote>
class bge.types.SCA_JoystickSensor( SCA_ISensor )

This sensor detects player joystick events.

axisValues

The state of the joysticks axis as a list of values numAxis long. (read-only).

Type : list of ints.

Each specifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing. The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.

  • left:[-32767, 0, …]
  • right:[32767, 0, …]
  • up:[0, -32767, …]
  • down:[0, 32767, …]

axisSingle

like axisValues but returns a single axis value that is set by the sensor. (read-only).

Type : integer

Note

Only use this for “Single Axis” type sensors otherwise it will raise an error.

This has something to do with the control pad?

I will need some more hints on this.