Why is a pawn moving even without inputs?

I have my own C++ class derived from APawn.
This class is reading input from axis to actually move itself on a plane.
The movement isn’t being done with a MovementComponent but with a custom method inside the pawn itself. I keep track of the velocity based on the input and move it accordingly.

The weird thing is that when I stop all inputs I see that my velocity is back to zero, but the pawn keeps moving like if inertia was applied. Is there any default component that might be interfering in any way?
Since I actually move the pawn only when the velocity is over zero, it shouldn’t move.
Any clues at where to look at?

Cheers!

Are you simulating physics on the pawn? Could actually be inertia like you mentioned (I think?)

Physics are disabled on the Sprite (the pawn contains a paper2dsprite and two boxcomponent) and on the two box components. Maybe there’s another option to check or a hidden component? Might it be something set in the tilemap’s components?

Hm I’m not sure. Do you think you could show me the function you’re using to move the pawn around?

Is it possible that your velocity isnt exactly zero? Typically you would check to see if its nearly zero within a small amount. Reason I ask is that its possible the inputs arnt exactly zero depending on input method (analog) and it does sound like a possible rounding issue.

The core of what’s going on is inside the update loop:

void AHeroPawn::Tick(float DeltaTime) {
    Super::Tick(DeltaTime);
    ...
    MoveH(Velocity.X * DeltaTime * 50);
    MoveV(Velocity.Z * DeltaTime * 50);
}

MoveH and MoveV simply move the sprite the amount passed checking if there’s a collision in between with simple overlap checks. I move the actor in the new position, check for collision and if it collides I move it back to the original position. Rinse and repeat.

The Velocity.X becomes zero as soon as I stop pressing the left or right key, but the pawn keeps moving. I exposed the value so that I can see it changing in the editor and it’s exactly zero when it still moves. There’s no fractions or rounding errors apparently.

The pawn is like shown there:

Simulate physics is turned off for all components. Physics material is none for all components.

I even added actions instead of axis as input types to make sure the value is either one or zero. I’m 100% sure it’s exactly zero. And since the pawn keeps moving even faster than it should, I’m pretty sure there’s some physics stuff going on, but I can’t understand what and where :stuck_out_tongue:

Has this problem solved? this also my problem

Is this problem solved? This is also my problem too, I’m using Blueprint though