My First Person Controller (CharacterBody3D) currently has no momentum at all. By the way, I measure my movement speed in the debug panel (hotkey ~) with velocity.length() and when I get pushed by one of the platforms (see the video), my speed stays at 0 while I’m being pushed, which isn’t how it supposed to be. What would be the best way to add a momentum/inertia feature and measure my current speed at all times?

Demo:

Source:
https://github.com/CryptoMares/FPS-Player-Controller

Thanks!

    CryptoMares CharacterBody is KINEMATIC, it is not moved by physics, it is moved by code.
    if you want the player to react to physics you need to use a rigidbody.

    if you want to measure the speed of a CharacterBody, the best way is to store the global_position in a variable and compare it with the global_position:

    var last_pos : Vector3
    var curr_speed : float = 0.0
    
    func _ready():
         last_pos = global_position
    
    func _physics_process(delta):
         curr_speed = last_pos.distance_to(global_position)
         last_pos = global_position

    I believe you can divide curr_speed by delta to get the speed per second:
    curr_speed = last_pos.distance_to(global_position) / delta

      Jesusemora Is there any way to add this kind of behavior to a Kinematic body? Rigid body will introduce a bunch of unwanted behaviours, that will need to be mitigated, I believe. Am I wrong?

      Megalomaniak I would love to learn how to use tweens for stuff like this. I would like to tween most of my variables, I don't know how though, I'm a newbie.

      kuligs2 Well, lerp is linear and I would like a curve. Ideally, a custom curve that I can control precisely.

      You could try to do something physics-like: measure your velocity, and then if no input and touching the ground: change it progressively to zero. If not touching the ground: change it progressively to straight down.

        axolotl That's too advanced for me to figure out on my own right now, unfortunately πŸ™‚

        I've been working on an answer for a few days. This has been something I've wanted and tried to do for a while now, so I'm happy that my asset was just accepted to the AssetLib! It's called Rigid Character Body 3D, if you're using Godot 4.2 or later you can take a look at it. It's not the greatest thing ever but I think it does a good enough job to get you going on this.
        It extends RigidBody3D and adds movement forces and drag which creates a simple and configurable character controller.

          wabbit why? πŸ˜ƒ GPL means that if you use it in your project, the rest of your project has to be published under gpl aswell.. and other stuff.. idk.. but ok πŸ˜ƒ

          wabbit That's awesome, thank you! However it's not exactly what I'm would like to achieve, I would like something of an imitation of momentum added specifically to a Kinematic Character Controller.