Set Physics Linear Velocity does not work correctly

I’m using set physics linear velocity to send something in a exact direction with a exact speed so that it will land exactly in the grid but the problem is that Set Physics Linear Velocity is far from exact. It appears it is not a “Set” (Add velocity is off), somehow previous physics velocity affects the Set linear velocity. The only way to make it behave exactly is to first Set all physics simulation off on the body then make a 0.01 delay, then set physics velocity back on again, then do the Set Physics Linear Velocity. With that it goes in the right exact direction and then lands in the grid. But turning physics off and on with a tick inbetween is not a good solution since I will also have to adjust it with Set Velocity every time it collides with something which then can result in some nasty bugs with turning physics off and on.

In case this is not a bug and a limitation of the physics engine Set Physics Linear Velocity should be at least renamed because from a Set I expect it to set the value I set in the Set.

P.S. I’m doing this in Blueprint and I’m not using any physics substepping.

This is still the case, apparently.

“Set the linear velocity of a single body. This should be used cautiously - it may be better to use AddForce or AddImpulse.”

Someone had the same issue in Slack, and I was directed here as a result in Google. I love that there are zero comments.

I think you nailed it with: “The only way to make it behave exactly is to first Set all physics simulation off on the body then make a 0.01 delay, then set physics velocity back on again, then do the Set Physics Linear Velocity. With that it goes in the right exact direction and then lands in the grid. But turning physics off and on with a tick inbetween is not a good solution since I will also have to adjust it with Set Velocity every time it collides with something which then can result in some nasty bugs with turning physics off and on.”

I thought adding an “Answer” might help get some movement. Also, if this is something that eventually needs work, it might be good to end up in the new bug tracker.

Not sure if this is relevant information, but PhysX is non-deterministic. You can’t use it to get precise, consistent physical interactions. You’d need to use a deterministic physics engine for that like Havok.

I think with cautiously it is referring to performance and if you just do set velocity every frame you could force it through collisions. They probably will never do anything about it because it is all Nvidias PhysX code. Someone of Epic said they put a new version of PhysX in 4.13, hopefully that fixes it but since it is something very fundamental I doubt it and it is just some bad limitation of PhysX.

I really wish Epic would have just sticked with Havok, had much less problems with that especially when it comes to funky skeletal ragdoll physics animation. No clue how it works but since it should be a flat set without any influences the non-deterministic part should not be a problem.