Page 1 of 1

Controller support

Posted: Fri Mar 07, 2014 4:17 am
by Jack5500
It would be nice to play the game with a controller, since the control scheme would fit on there as well. I thought I'd open a thread here to discuss this, since I can't open an issue on github. I tried to implement it by myself, but seems be non-trivial.

Re: Controller support

Posted: Sat Mar 08, 2014 3:47 pm
by APsychonaut
as a stop-gap, emacs?

Re: Controller support

Posted: Sat Mar 08, 2014 4:22 pm
by Thomason1005
If you have the project opened in unity, you can reassign the keys in project settings -> input, but i dont know how the thumb sticks are handled

Re: Controller support

Posted: Sun Mar 09, 2014 4:11 pm
by Jack5500
As mentioned I already tried to implement it and the current code coesn't support controllers per se.
The view sticks are not resseting which results in a strafing for the movement and view.

Re: Controller support

Posted: Tue Mar 11, 2014 9:05 am
by Thomason1005
i dont know how far you have it working so here goes how to do it:

the buttons are easiest, go to edit ->project settings -> input, then on the right simply put the controller button you want as alternate input:
Unbenannt.png
Unbenannt.png (18.66 KiB) Viewed 11488 times
the button numbers are like on this image: http://wiki.unity3d.com/index.php?title ... Controller

for the cam rotation first right-click the mouse x input and duplicate it, then change type to joystick axis and axis to x axis and maybe sensitiviy to 1 (never over 1! adjust it in the esc-screen or multiply it in the script) and dead zone to 0.1
then do the same with the y axis
for walking, duplicate these and set the axis to 4th and 5th, i named them "Controller Vertical" and "Controller Horizontal"
you should check the invert checkbox on controller y and controller vertical
Screenshot 2014-03-11 14.52.10.png
they dont work yet, you have to grab these inputs in the script.
go on the bottom left to scripts, them open aimscript and search for "mouse x"

you have to add the controller axis so you add

Code: Select all

		rotation_x += Input.GetAxis("Controller X") * sensitivity_x;
		rotation_y += Input.GetAxis("Controller Y") * sensitivity_x;
beneath the mouse axis lines

and a few lines beneath

Code: Select all

			view_rotation_x += Input.GetAxis("Controller X") * sensitivity_x;
			view_rotation_y += Input.GetAxis("Controller Y") * sensitivity_x;
for walking, go in FPSInputController.js and replace line 15 with

Code: Select all

	var directionVector = new Vector3(Input.GetAxis("Horizontal")  + Input.GetAxis("Controller Horizontal"), 0, Input.GetAxis("Vertical") + Input.GetAxis("Controller Vertical"));
save your script files and run the game, it should be working now

running doesnt work like this, maybe map the alternate positive button in horizontal input to a controller button, then you can tab it quickly to run

if you tell me where you want which buttons ill add these to my receiver mod.

Re: Controller support

Posted: Wed Mar 12, 2014 8:05 pm
by Constance
There's also a program called JoyToKey which enables Gamepad to Keyboard/Mouse input.

Re: Controller support

Posted: Thu Mar 13, 2014 12:27 am
by Thomason1005
Timbles wrote:There's also a program called JoyToKey which enables Gamepad to Keyboard/Mouse input.
yeah but you wouldnt have to do all the things which would be kindof lame

Re: Controller support

Posted: Fri Apr 25, 2014 12:42 am
by C00NT0NE
As mentioned, the camera stick can't function. I just used my PS3 controller (setup by MotionInJoy,) and I enabled the automatic camera option, so I was always looking in the direction I was moving. It was just taste, but I can tell that I'll like this game more with the controller support!