Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Adding Sneaking to FirstPersonController

Discussion in 'Scripting' started by Wilelle, Jun 24, 2015.

  1. Wilelle

    Wilelle

    Joined:
    Jun 16, 2015
    Posts:
    93
    I'm using the first person controller that comes with Unity 5, but I want to add some things. The main one being sneaking, which will make the player move slower and make the steps be further apart than when walking. Basically opposite-running.

    Problem is, I have no idea how to do this in C#. I only work in Javascript. I know, I know, people keep saying C# is superior, but I like Javascript. So can someone tell me how to do this? Or maybe point me to a Javascript version of the first person controller? Haven't found one myself.
     
  2. unitychristy2

    unitychristy2

    Joined:
    Sep 8, 2013
    Posts:
    38
    I think the standard controller fps has the function that when you run in a direction and hold down shift it runs. Just find the code related to the shift action and make it a lot slower.
     
  3. Wilelle

    Wilelle

    Joined:
    Jun 16, 2015
    Posts:
    93
    I really should start removing threads when I answer them myself... I figured out how to connect a Javascript to the standard FPS script and I've solved this problem on my own. I was just too lazy to update this to let people know I didn't need help anymore since I thought it has already vanished into the ocean of unanswered questions.