In godot 3.5 I would just transform.z -= speed but this doesn't work in Godot 4

  • If it's actually a character body, then the code will be something like this:

            ParentNode.Velocity = velocity;
            ParentNode.MoveAndSlide();

    Velocity is a vector3 for the direction, and ParentNode is the characterbody3d in this case, BUT godot 4 has a script template for simple WASD/jump movement that you can pick when making your characterbody. It has good demo code that shows how to do things:

If it's actually a character body, then the code will be something like this:

        ParentNode.Velocity = velocity;
        ParentNode.MoveAndSlide();

Velocity is a vector3 for the direction, and ParentNode is the characterbody3d in this case, BUT godot 4 has a script template for simple WASD/jump movement that you can pick when making your characterbody. It has good demo code that shows how to do things: