Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamepad support #1

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

Gamepad support #1

jareiko opened this issue May 24, 2012 · 9 comments
Assignees
Labels

Comments

@jareiko
Copy link
Contributor

@jareiko jareiko commented May 24, 2012

No description provided.

@ghost ghost assigned jareiko May 24, 2012
@straps
Copy link

@straps 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
Copy link
Contributor Author

@jareiko 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
Copy link

@straps 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
Copy link
Contributor Author

@jareiko 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
Copy link

@straps 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
Copy link
Contributor Author

@jareiko 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
Copy link

@straps straps commented Jun 1, 2012

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

Thank you very much.

@jareiko
Copy link
Contributor Author

@jareiko 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
Copy link
Contributor Author

@jareiko 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.