Gamepad support #1

Closed
jareiko opened this Issue May 24, 2012 · 9 comments

Comments

Projects
None yet
2 participants
@jareiko
Contributor

jareiko commented May 24, 2012

No description provided.

@ghost ghost assigned jareiko May 24, 2012

@straps

This comment has been minimized.

Show comment
Hide comment
@straps

straps May 31, 2012

I would like to collaborate on adding this feature, especially integrating an Android app I'm developing that turns a mobile phone into a gamepad using the accelerometer.
I don't know Three too much, but TriggerRallyOE could be the perfect game to test my app and a really interesting experiment for such technology.
Would you like to help me?
Contact me for futher details, thanks.

straps commented May 31, 2012

I would like to collaborate on adding this feature, especially integrating an Android app I'm developing that turns a mobile phone into a gamepad using the accelerometer.
I don't know Three too much, but TriggerRallyOE could be the perfect game to test my app and a really interesting experiment for such technology.
Would you like to help me?
Contact me for futher details, thanks.

@jareiko

This comment has been minimized.

Show comment
Hide comment
@jareiko

jareiko Jun 1, 2012

Contributor

That sounds like an interesting project! Will your app appear through the standard gamepad API or will it require separate support in the app?

Contributor

jareiko commented Jun 1, 2012

That sounds like an interesting project! Will your app appear through the standard gamepad API or will it require separate support in the app?

@straps

This comment has been minimized.

Show comment
Hide comment
@straps

straps Jun 1, 2012

In this stage I think dedicated support is better, and I'm not thinking to connect the phone via USB, but transfer accelerometer coordinates via socket.io; think:

  • Go to triggerrally.com
  • Press play now
  • Reading a QR code, my android phone open up an application that connects to a unically generated session code
  • The mobile app sends accelerator events via node.js/socket.io to the game that react to them

My phone become a wireless gamepad.

Thank at how many possibilities you have structuring it a little bit: multiplayer games could be only the first evolution.

What do you think?

straps commented Jun 1, 2012

In this stage I think dedicated support is better, and I'm not thinking to connect the phone via USB, but transfer accelerometer coordinates via socket.io; think:

  • Go to triggerrally.com
  • Press play now
  • Reading a QR code, my android phone open up an application that connects to a unically generated session code
  • The mobile app sends accelerator events via node.js/socket.io to the game that react to them

My phone become a wireless gamepad.

Thank at how many possibilities you have structuring it a little bit: multiplayer games could be only the first evolution.

What do you think?

@jareiko

This comment has been minimized.

Show comment
Hide comment
@jareiko

jareiko Jun 1, 2012

Contributor

It does sound very cool! Unfortunately I don't know how much help I can offer though, as I have a number of other things I'm working on at the moment. Is there anything in particular you need help with?

Contributor

jareiko commented Jun 1, 2012

It does sound very cool! Unfortunately I don't know how much help I can offer though, as I have a number of other things I'm working on at the moment. Is there anything in particular you need help with?

@straps

This comment has been minimized.

Show comment
Hide comment
@straps

straps Jun 1, 2012

Yes, accelerometer give me an analogues value that I approximate from 0 to 10.

In what part of TriggerRallyOE can I say accelerate/decelerate/turn-left/turn-right of 1 unit, or 2 units or 10 units...

Thanks. This could be enough for me to start some local testing.

straps commented Jun 1, 2012

Yes, accelerometer give me an analogues value that I approximate from 0 to 10.

In what part of TriggerRallyOE can I say accelerate/decelerate/turn-left/turn-right of 1 unit, or 2 units or 10 units...

Thanks. This could be enough for me to start some local testing.

@jareiko

This comment has been minimized.

Show comment
Hide comment
@jareiko

jareiko Jun 1, 2012

Contributor

Have a look here:

https://github.com/jareiko/TriggerRallyOE/blob/master/src/drive.js#L539

The control values are currently 0 or 1 depending on whether a key is pressed. But it should work smoothly with any analogue value between 0 and 1 as well.

If you have a "turn" value from 0-10, you might want to map them as follows:

if (turn < 5) {
controls.left = 1 - turn / 5;
controls.right = 0;
} else {
controls.left = 0;
controls.right = turn / 5 - 1;
}

Contributor

jareiko commented Jun 1, 2012

Have a look here:

https://github.com/jareiko/TriggerRallyOE/blob/master/src/drive.js#L539

The control values are currently 0 or 1 depending on whether a key is pressed. But it should work smoothly with any analogue value between 0 and 1 as well.

If you have a "turn" value from 0-10, you might want to map them as follows:

if (turn < 5) {
controls.left = 1 - turn / 5;
controls.right = 0;
} else {
controls.left = 0;
controls.right = turn / 5 - 1;
}

@straps

This comment has been minimized.

Show comment
Hide comment
@straps

straps Jun 1, 2012

Is it the same for acceleration? Can I use values between 0 and 1?

Thank you very much.

straps commented Jun 1, 2012

Is it the same for acceleration? Can I use values between 0 and 1?

Thank you very much.

@jareiko

This comment has been minimized.

Show comment
Hide comment
@jareiko

jareiko Jun 1, 2012

Contributor

Yes, it applies to acceleration too. It should also apply to the brake controls, but they may interact strangely with the automatic gearbox. I haven't tested it!

Contributor

jareiko commented Jun 1, 2012

Yes, it applies to acceleration too. It should also apply to the brake controls, but they may interact strangely with the automatic gearbox. I haven't tested it!

@jareiko

This comment has been minimized.

Show comment
Hide comment
@jareiko

jareiko Sep 29, 2012

Contributor

Gamepad support added.

Contributor

jareiko commented Sep 29, 2012

Gamepad support added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment