I call float speed = LinearVelocity.Length(); in my code for a Player node (RigidBody3D). The strange thing is that the speed does not go down to 0. It stops at about 0.053 and I can see the Player so very slowly move. There is a Physics material on the Player and the friction is set to 1. I am using Godot Engine v4.2.2.stable.mono.official [15073afe3].

I am rather knew to Godot so I was wondering if there is something I am missing?

And I am new to this forum so I am not even sure if this is the correct place for this type of question - I just found the Start a Discussion button.

    Battern I don't really know the answer but one thought that immediately came to mind is that physics engines usually leave tiiiiiny gaps between or around objects. For example if you would zoom in far enough you could see a person float a couple of millimeters above the ground instead of standing exactly plane on the ground.

    They do this to compensate for inaccurate floating point calculations and to prevent objects from overlapping. This could happen in the early days of physics engines where you would sometimes see an object getting catapulted away into the sky for no apparent reason. This could happen especially after spawning a new object or entering a level or reloading a savegame.

    So maybe this is caused by this tiny gap. Hard to say without knowing what you do or how your code looks like.

      Toxe How does the collision margin affect the velocity? Is there something I'm missing?

      • Toxe replied to this.

        I would remedy this in code by doing something like:

        if (Mathf.IsZeroApprox(speed))
        {
            speed = 0f;
        }
        • xyz replied to this.

          trizZzle Is there something I'm missing?

          Probably not. I am just trying to come up with ideas but until we see actual code or a video all of this is speculation.

          spaceyjase It's a rigid body. Messing with its velocity directly is not a good idea in most cases.

            The project files would be helpful, I couldn't reproduce it. My RB didn't move despite have a linear velocity length of 0.058.

              Toxe Yes, it is probably part of the system.
              The real problem was that it affected the movement of my Player - it moved so very slowly accros the ground but we (I am doing this project with my son) solved that problem with a simple if statement. See code below. The idea was actually my sons.

              I really do not know if this will cause any problems. I guess it will not. I discussed it with my son who suggested to try the Jolt system instead so I am going to try that.

              The real problem now though is finding the "Emission Shape" alternative so I have posted a question about that. I am sure the question is stupid but I am new to this and when I cannot follow the tutorials because I miss doing something obvious or because things have changed . . . . :-(

              private void PlayerMovement(double delta)
              {
              // Initialize the input vector to zero
              Vector3 input = Vector3.Zero;

               // Getting input for the X-axis (left and right movement)
               input.X = Input.GetAxis("move_left", "move_right");
              
               // Getting input for the Z-axis (forward and backward movement)
               input.Z = Input.GetAxis("move_forward", "move_back");
              
               // Only apply force if there's significant input
               if (input.LengthSquared() > 0.0001f) // Use a small threshold to ignore tiny inputs (Future inputs may give other inputs than the keyboard (1, 0 or -1) so use a general solution.)
               {
                   // Apply the calculated force, transformed by the twist pivot's rotation (yaw)
                   ApplyCentralForce(twistPivotNode3D.Basis * input * 10000.0f * (float)delta);
               }

              }

              (The value 10000.0f will be replaced with a variable, just testing things you know :-) )

              trizZzle Please see reply to Toxe. It explains the situation a bit.

              xyz yeah agreed generally. I think back to a golf project where the ball is a Rigidbody but continued to move tiny increments; that's what _integrate_forces is for, the ball was stopped when below a small fraction. Dunno what OP is up to though.