Dive Board



[GUIDE]How to map PS3 controller buttons

[GUIDE]How to map PS3 controller buttons

by acocalypso on Jan 5th, 2014 18:28 PM

Hey everyone,

i just wanted to show you how to map PS3 controller buttons in Unity for the Dive.

At first take a look at the mapping sheet.
Every button has a key code.

Button codes:


Axis codes:



To use this codes to perform to do diffrent functions like shooting or jumping you just need to write the following code:

if (Input&#46;GetButton (&quot;Fire Weapon&quot;))<br />{<br />     // Your code goes here<br />}<br />


You need to setup the "Fire Weapon" button in Unity under
"Edit/Project Settings/Input



In my Code i used the "Fire Weapon" Tag as Name.
In my sheet i want to use R1 to fire so i need the number 7.
On "Positive Button" enter number 7.

To make an Application compatible for Crossplattfrom you also assign an alternative button like the left mouse button.
Make sure to set Joy Num to "Get Motion from all Joysticks" and your done.

This guide will work with any Controller as long as you know the key codes.


Thanks for reading. If you have any questions just ask.

Sorry for my grammer my native language is German.


Credits:
PS3 Key Codes take from http://forum.unity3d.com/threads/89288-PS3-Button-Map
Thanks to Stefan for the Dive plugin
Thanks to the Dive community for the great projects.

acocalypso

Posts: 25

Joined: 03.12.2013

dive-owner


Re: [GUIDE]How to map PS3 controller buttons

by Ianmcmill on Jan 6th, 2014 17:56 PM

Very nice ! Thanks for sharing.

Ianmcmill

Posts: 10

Joined: 19.12.2013


Re: [GUIDE]How to map PS3 controller buttons

by appie21 on Jan 13th, 2014 23:01 PM

Hi

How to setup for bleutooth controllers like idroid snakebyte and so on!

appie21

Posts: 35

Joined: 16.12.2013


Re: [GUIDE]How to map PS3 controller buttons

by obiwahn on Jan 14th, 2014 06:16 AM

"appie21" wrote:
Hi

How to setup for bleutooth controllers like idroid snakebyte and so on!




Hi :) did this ps3 controller mapping work for you? If yes, can you share a screenshot of the settings for the jump in your game? Would be very nice, didnt work for me... :) i get an idroid the next days an will work out the key mapping for unity.

obiwahn

Posts: 25

Joined: 11.01.2014

dive-owner


Re: [GUIDE]How to map PS3 controller buttons

by acocalypso on Jan 14th, 2014 10:06 AM

@appie21 check this youtube video http://www.youtube.com/watch?v=MsPmzsapVkk

@obiwahn im going to correct this keysheet cause some buttons are switched. like R1 and R2.

Keycodes for snakebyte:con can be found in the official idroid manual on the last two pages: http://www.snakebyte-europe.com/uploads ... ual_uk.pdf

acocalypso

Posts: 25

Joined: 03.12.2013

dive-owner


Re: [GUIDE]How to map PS3 controller buttons

by obiwahn on Jan 14th, 2014 11:18 AM

"acocalypso" wrote:
@appie21 check this youtube video http://www.youtube.com/watch?v=MsPmzsapVkk

@obiwahn im going to correct this keysheet cause some buttons are switched. like R1 and R2.

Keycodes for snakebyte:con can be found in the official idroid manual on the last two pages: http://www.snakebyte-europe.com/uploads ... ual_uk.pdf



Thank you very much! :D

obiwahn

Posts: 25

Joined: 11.01.2014

dive-owner


Re: [GUIDE]How to map PS3 controller buttons

by appie21 on Jan 14th, 2014 21:55 PM

Many many thanks

appie21

Posts: 35

Joined: 16.12.2013


Re: [GUIDE]How to map PS3 controller buttons

by appie21 on Jan 15th, 2014 09:43 AM

Hello

All I have try to mapping with the IDroid

But how canI change the text in unity by input?
Any Advice?

appie21

Posts: 35

Joined: 16.12.2013


Re: [GUIDE]How to map PS3 controller buttons

by acocalypso on Jan 15th, 2014 14:10 PM

What do you mean with "by Input"?

Do you want to change the Upper "Fire Weapon" Name?
you have to create a new Input an name it as you like

for more information about the InputManager just take a look into the Unity Manual
http://docs.unity3d.com/Documentation/Manual/Input.html

acocalypso

Posts: 25

Joined: 03.12.2013

dive-owner


Re: [GUIDE]How to map PS3 controller buttons

by jpslara on May 10th, 2014 19:34 PM

"acocalypso" wrote:
...i just wanted to show you how to map PS3 controller buttons in Unity


Thank you for this explanation, but I need some thing more specific. When I understand how Input from Unity works, I wrote an scripts to see what code tell Unity that a keybutton have. In fact Sephiroth viewtopic.php?f=1&t=2741 have publish a program that tell you what code you gamepad have press.

Well the fact it is that I have a gamepad that appear not give any code when you press buttons apart from right cross, that gamepad work perfectly in other android programs, with all his button work properly, I like to know if some body Know how to map this buttons previously to Input in that way that Unity recognize those buttons?

jpslara

Posts: 80

Joined: 27.12.2013

dive-owner


STATISTICS


Total posts: 90408


Total topics: 10675


Total members: 38988


Newest member: Daniel G.