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.