Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

FPS Controller Improvements (Code Review/Criticism)

Hi all!

First post, forums are looking mighty slick.

I'm posting for some advice/ideas/criticism on a general FPS Controller that allows a variety of features like Momentum, Air-Control, Wall climbing etc.

Thus far the controller consists mainly of Brackey's FPS controller in his latest tutorial, but with my own additions regarding the momentum side of things. I'm looking for any suggestions on how to improve how I'm handling velocity/momentum/air-control.

Currently, it feels pretty good which I'm happy to say the least. However, I feel it can be improved massively. I.e., I can provide more air control by tweaking the airSpeed variable but it feels slightly clunky.

Here's a link to the code:

Any suggestions are greatly appreciated, or even if you think I should be approaching this differently.



Best Answers

  • WarpWarp Administrator
    edited May 2020 Accepted Answer

    Oh I see.

    You're saying that if you sprint, and then jump, you should keep sailing through the air even after releasing controls? It should keep your velocity?

    If so, I can help there.

    1. When the input is received for a jump, store the players current velocity (_playerController.velocity) in a variable.
    2. While the player is in the air (!isGrounded) apply that velocity throughout the jump, while applying gravity.
    3. When the player touches the ground, reset their velocity based on inputs.

    If done right, this should produce movement more akin to Counter-Strike than the floaty, unrealistic movement the Brackeys vid produces.

    If you need clarifying let me know! Also, Brackeys doesn't notify me unless you @Warp me, so @ me to be certain I get notified.

    Good luck!

  • WarpWarp Administrator
    Accepted Answer

    Awesome to hear!

    Happy to help :D


  • WarpWarp Administrator


    Can you elaborate on what you mean by "Momentum, Air-Control, Wall climbing etc."? What are you trying to achieve as an end product?

    Also, comments on your code would be very helpful, there are some functions that are ran for reasons I cannot understand in the context of the script, so some comments over them would be helpful.


  • MrSlugMrSlug Member

    Thanks for the reply,

    I suppose the three buzz words are quite vague, what I mean is the controller should maintain momentum when jumping (Ballistic jumping) while allowing air control, which would be adjusted via a variable like airSpeed. Really, that's my main goal here, the rest is further down the pipeline.

    Here's an updated pastebin mate!:

    I hope the comments clear things up, happy to add more if needed.



  • MrSlugMrSlug Member

    @Warp Brilliant mate!

    I applied what you said and tweaked it to allow air control, as your suggestion resulted in (Much cleaner than what I had) ballistic jumping.

    With the addition of inputs multiplied by a modifier I have complete control over air control which is bang on what I wanted.

    Thanks a lot my man!



Sign In or Register to comment.