I’m trying to rely on velocity to know when an actor is moving so that i can stop the walking animation, but when pushing against physics objects, even if immobile, the velocity is quite high, it is fine with static meshes such as walls
As an example there are parked cars in my level, if i walk and push against one my velocity will stutter from 0 to 15+ making my animation go from idle to walking in a quick succession, the cars have suspension and have subtle motion when pushed against, this is probably what is causing the velocity spikes
Meanwhile, is there another method to detect if an actor is moving, that is more accurate?
Thank you for the report. I was able to reproduce this behavior so I’ve created JIRA UE-26144 in our tracking software. Our developers will be investigating the issue further.
As a workaround, you could set the vehicles to stop simulating physics when unpossessed. If anything needs to happen to the vehicles like blowing them up, you could always set simulate physics to enabled again right before the event.
Unfortunately this isn’t possible since i want the vehicles to have suspension and react to the player jumping on them even when parked, actually they are always parked since they’re wrecked cars
Here’s another example where velocity is inaccurate, when the player is stepping on a slope it adds to the velocity even if immobile and makes my player go into walk mode
I really need an accurate method to detect if my player is moving
Okay, thanks for the example gif. I’ll make sure to include it in the JIRA report.
It is expected that the character has zero velocity when walking against static geometry and doens’t make any forward progress. It sounds like you are seeing that.
As for pushing against physics objects, this is likely due to small movements between impacts, so that with high acceleration the character tries to move at a high velocity, but then makes less progress on impact, but then avoids impact again briefly and accelerates higher again.
My suggestion if this is a problem is to use the result of GetPhysicsLinearVelocity() on the capsule instead, as that is a velocity calculated based on the distance/time within the phsyics scene and has less to do with our desired instantaneous velocity which is more what you’re seeing.
I don’t have a good explanation for the case in the gif you provided. However checking physics linear velocity should be stable there.