PuniTy and Controller Support – Getting thumbsticks to feel good

*     *     *

You can download the updated version with controller support on itch.

*     *     *

Wow, it’s been more than a month since PuniTy’s release. Time is flying, to say the least.

People have been asking me what my plans are for expanding the game since its release, and I’ve wanted to add oculus and controller support as I feel those two things benefit the experience a lot. Controller support is now in, but the oculus version is unfortunately delayed as I couldn’t get the rift to work on my Windows 10 machine for roughly 3 weeks of trying. Now that the new 0.7 SDK is out I may try again at some point in the future.

I have no intention of expanding the hallway / gameplay beyond what is already there, as I have my own game ideas I’m very excited in pursuing. If you’re looking to play the full PT hallway on PC, there’s undoubtedly a group of talented people already working on it and you’ll definitely see it pop up down the road.

*     *     *

Despite using Unity for 3 years now I had never implemented controller support for any games I made as I always went with mouse and keyboard, so I was looking forward to finally learning this. I didn’t want to use Unity’s native support for controllers as I was afraid that would only support a small subset of gamepads (namely just the 360 controller), and multiple people recommended the unity asset Rewired as a robust choice that supports a lot of controllers. So that was my starting point.

I quickly learned that the default configuration for a controller doesn’t feel good. I had no idea that the slightest twitch of a thumbstick will register some movement, as I’ve always experienced controls after they’ve been refined. Another example of “taking controls for granted” is it’s near impossible to turn left and right without moving your head up or down thanks to the super responsive thumbsticks.

Sp by developing gamepad support it made me appreciate other games and the work they put into refining their controller feels. Here are the steps I went through for implementing my own controller support.


I really wanted to get rid of that super-sensitivity, and I didn’t understand how important deadzones were until now. They are an essential step towards giving the player more deliberate control over their movement and view. If you’ve never heard of the term it’s simply a region of joystick movement that ignores input, whether completely or partially.

A prime example is turning right or left in a first-person view. A classic example is ignoring input when slightly tilting the joystick in any direction to allow more deliberate movements. Another is as mentioned above, if there’s no axis deadzone on the analog stick it’s near impossible to turn horizontally without some vertical movement as well and vice-versa, as our thumb will rarely ever move the stick perfectly in the four cardinal coordinates.

By default a controller has no deadzones (0 on the scale implies no thumbstick tilt, whereas 1 is fully tilted):

For PuniTy’s camera I ended up going with this:

A thumbstick tilt between 0 and 0.1 will not register any turning. This helps create deliberate movement for the player and allows complete horizontal and vertical movement without them bleeding into one another. Thumbstick values between the range of 0.1 – 0.9 are remapped to a 0 – 1 range for full motion, and values between 0.9 and 1 are always treated as 1 so there’s some relief incase a player doesn’t hold the thumbstick at full tilt for maximum camera rotation.

For PuniTy’s movement I ended with this:

punity movement range

I implemented two speeds for movement, a slow walk and a normal walk. After playing with the numbers I settled with a threshold of 0.65 thumbstick tilt for the normal walk, and below that value for the slow walk. The deadzone below 0.1 is again very important for deliberate movement.

View Speed – Vertical Damping

If you’ve ever played a first-person game with a controller you might have noticed how your horizontal turn speed is faster than your vertical tilt. One reason is turning horizontally has a 360 degree range whereas vertically only has 180, and covering that smaller range at the same speed used for left and right panning is way too fast. Another reason is most FPS games have important information, such as enemy placement and spatial navigation, happening in your horizontal field of view more so than your vertical boundaries, so a fast vertical tilt speed is further unnecessary (though modern games are also placing important info in the vertical field as well which is fantastic).

After playing around some I implemented a vertical look speed that’s 0.7 times the horizontal speed. This felt right in the middle of too slow and too fast.

View Speed – Quadratic Interpolation

By default, linear interpolation is used for determining camera rotation based on thumbstick tilt, so you get out exactly what you put in:

But this sucks for higher sensitivities as fine movement is lost when slightly tilting the thumbstick. It also doesn’t feel good for medium/lower sensitivities as the thumb placement needed to maintain a certain speed is too precise. What’s needed is some sort of quadratic interpolation:

Even using the default curve Unity provides in its animation curves feels fantastic. Now even at higher sensitivities you can maintain fine control over the camera, lower sensitivities have a nice flow to them. Try testing different curves to see what best suits you and your players.

*     *     *

I didn’t implement the following features, but they carry varying importance depending on your game.

More Polish – View Acceleration

Something many games feature, such as Halo, Gears of War, and Wolfenstein: The New Order is view acceleration. Simply put, the longer you rotate your view at your thumbstick’s maximum tilt, the more the camera will accelerate its movement until hitting a speed cap. Typically this cap is hit between 1 to 2 seconds after maximum tilt is reached. The thought process behind this is if a player needs to scan their environment rapidly or look behind themselves, the acceleration will help them reach their desired view a bit quicker.

More Polish – Movement Axis Deadzones

After putting hours into Dark Souls 1, I immediately noticed this feature implemented in Dark Souls 2 and Bloodborne. When tilting the thumbstick in any of the cardinal directions (North, East, South, West), the axis opposite to the one being used is given a small deadzone to help the player move in those absolute directions:

So if a player wants to move directly forward, a y-axis value between 0 and 1 is needed along with an x-axis value of 0. But as with the view deadzones, it’s hard to tilt a thumbstick directly north without bleeding in some horizontal movement, especially from a standing position. Dark Souls 1 didn’t have this feature however the subsequent games did, and I found it really helped for precise movement (because those games DEMAND precise movement at times).

Let me know of any other tricks you use to get a good feeling controller in the comments.

Bookmark the permalink.


  1. Hi Farhan, you said that you had been trying to get your Rift working with Windows 10, correct? I’d like to help if I can.

    First, what version of the runtime are you using? Is it
    Second, what have you tried to get it working?

    I think I offered up this suggestion on twitter, but I can better explain it here. If using, then do this:

    1. Navigate to C:\Program Files (x86)\Oculus\Service. There you will find 3 .exe’s.
    2. Right click on the x86 service exe, then go to properties. Click the compatibilty tab, and set the compatibility to Windows 8. Also set it to run as administrator.
    3. Make sure the Rift is on, and run the exe. This should bring up a command prompt, and you should get a Windows notification that it was able to find the Rift as a device, and that the service is available.
    4. To test it, go to the notifications bar and find the eye icon. Right click it, then click “Configuration Utility”. Then at the bottom of the window, click “Show demo” or something like that. If it brings up the demo and you can see it in the Rift properly, then it is working.

    However, currently on Windows 10 and, only Extended mode works. If you want Direct mod (Well, Direct Driver mode as it’s called now), you’ll want to use the 0.7 runtime and SDK.

    Let me know if you’ve tried it, and if not, how it goes!

    • Hey Austin, thanks for posting. I remember the suggestions on twitter for getting it to work with windows 10. I’ve tried using windows 8 compatibility mode multiple ways, whether setting a few or all the exes in that folder, but nothing seemed to make a difference. I even tried installing a windows 8 graphics driver for my video card but it still didn’t take even with as many things as I could set on windows 8 compatibility. To clarify, the oculus configuration utility never once detected my rift. I rechecked wires, uninstalled and re-installed multiple times, but nothing took.

      I have yet to try the new 0.7 SDK though which I think has preliminary windows 10 support, so that sounds like it could help.

      • Well, the 0.7 SDK and runtime have Windows 10 support, so installing those should work just fine.

        Shouldn’t take too long to do either! 😀

  2. hi farhan
    nice work
    can you add the room we are in for the first time in the p.t ? you can even capture the video of exiting the room from p.t and just put it in the begining

  3. Firstly, congratulations for the project! I would like to ask you if there is the possibility to share the Unity source for educational purposes?

  4. SilentHillFetishist

    Why does only LMT, RMT, ESC, W, A, S and D work? I Can’t examine anything

  5. Hello Farhan! I’d only like to ask a few things of you.

    1: Could you possibly explain how the events work? I’ve been playing around with it for a while, and the events seem to happen randomly. Is there a certain position that triggers the, are the time based, or what?

    (Don’t mind if you don’t do this one) 2: Could you add a button that allows you to open doors, like the bathroom one, or the end of the hallway, past the lamp(only making it so if you go through, it just loops, and doesn’t change anything.).

    3: Maybe make the radio work? Maybe???

    (PLEASE do this one!) 4: Can you release a source code for UnityEngine, so that fans can continue it, or edit it, just (with a privacy policy or something, if you want to copyright it.) I’d PREFER it be free… but doesn’t have too.

    Thanks Farhan!

    • Sorry for the late response. Nothing is random in the hallway. There are trigger volumes that activate one after the other. If you walk through the hallway enough you’ll figure out where they are. I’m not working on expanding the game at all so you’re stuck in the same hallway and radio unfortunately. Someone is definitely making a way-better version as I type this and you’ll experience the full thing at some point.


  6. Hi, great work first ! So according to what you wrote, does it mean you know as a fact that someone is making a PT game ? Thank you.

  7. Don’t suppose you ever got this working for vr systems at all? (more specifically the rift).

    If not, is there any way I could possibly get a copy of the project to add in the support myself?

  8. I think I talk more than “just me” when I say “why don’t you accept donations?” as a motivation to make a full PT version! with puzzles and the fetus!!
    I would be willing to help through donation!! having a full version would be so cool!!!

  9. Great job man, I never play horror games but for a while now I’ve been wanting to play P.T. But unfortunately it was taken down from the Playstation Store before I could get my hands on it. But thanks to you I can finally Play a small portion of the game thank you for the experience and I can’t wait for it to be Rift compatible, Once again THANK YOU 😀

  10. One day, will you return to PuniTy? Obviously, the game right now is just a sample of P.T., but what we have now is SO good, and I believe you can make more for this game. Right now, there are no signs of anybody making a copy, and you might be our only hope.

    So, I wish you good luck on your future games, my man, and I’ll be following them. I just hope you plan to expand in PuniTy later. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *