Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Standard Assets FPController Still Moves After Letting Go Of Keys

Discussion in 'Scripting' started by GrayWoolsey, Jul 2, 2020.

  1. GrayWoolsey

    GrayWoolsey

    Joined:
    Apr 20, 2018
    Posts:
    27
    I'm currently using the Unity Standard Assets first person character controller available on the asset store in my project. Not the Rigidbody controller just the regular one, and whenever I move and let go of a movement key the character still walks just a little ways. I'm pretty new to C# and the FirstPersonController script is a bit confusing. Can anyone help me out with the best method on cancelling all movement velocity when I let go of a movement key? I'm not sure which part of the script would be useful to include here so I'll just say it's the Unity Standard Assets first person controller script. I also know that the package is very out of date and I should write my own character controller but I have yet to get around to that as I'm still trying to learn the engine.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,936
    Gotta figure out what's causing it first.

    Could be the filtering inherent in Input.GetAxis()... try replacing it with Input.GetAxisRaw()

    Could be rigidbody momentum, if it uses those.

    Could be some other form of gradual velocity change explicitly implemented in code.

    Your best bet is to find where the movement is applied and start printing out quantities, then "work further up the chain" until you figure out why they are not dropping to zero immediately when you release the input.
     
    Joe-Censored and GrayWoolsey like this.
  3. GrayWoolsey

    GrayWoolsey

    Joined:
    Apr 20, 2018
    Posts:
    27
    Using "GetAxisRaw" where it's receiving the input worked like a charm. Thank you very much for your reply!
     
    Kurt-Dekker likes this.