3rd Person Camera & Controller C#


Does anybody know if I can get the 3rd person camera and controllers that ship with unity in c#. Eventually I will create my own but I would like to use the one that ships with unity for a quick prototype. I’ve made an on screen thumbstick that holds its own axis values so I need to modify the script so that it takes my thumbstick axis values instead.

I don’t believe someone have translated both scripts to C# - they are too complex, and the translation would be a typical too pain, no gain case. But you can modify the ThirdPersonController.js script to use your thumbstick:

1- Create a new folder at Assets and place your C# script there - this enables it to “see” the ThirdPersonController script.

2- Modify your script to copy the axis values to two static vars located at the ThirdPersonController script:
ThirdPersonController.axisH and ThirdPersonController.axisV

3- Add the two lines below at the beginning of the ThirdPersonController script:

   static var axisH: float = 0;
   static var axisV: float = 0; 

4- Locate the two lines below:

   var v = Input.GetAxisRaw("Vertical");
   var h = Input.GetAxisRaw("Horizontal");

and change them to:

   var v = axisV;
   var h = axisH;

This is enough to do the basic movements with your thumbstick, but doesn’t include the Shift or Jump keys - you must use the keyboard shift and your thumbstick to make the character run, and the Jump key at the keyboard to make it jump. If you have equivalents to these commands in your thumbstick, use the same logic to implement them in the ThirdPersonController (search for Input.GetKey for the shift, Input.GetButton for the jump).