This is an issue I’ve recently encountered with Unreal Engine 5.4’s Character Movement component. As it says in the title, the issue is that there is no inertia when a character jumps off of a moving object (i.e. a platform), and the velocity is immediately zero when leaving the platform. This causes a major issue when attempting to get off the platform by walking off in the direction it is travelling, where the player keeps snapping back onto the platform since the velocity is zero.
It’s pretty simple to replicate. If you open a new third-person test project and code a simple platform to move back and forth from two locations, then printing the velocity of the character movement shows that it remains zero, even when exiting the platform.
Is there any way around the issue? Should I figure out the player’s current and last updated position to just apply the velocity manually when jumping off the platform? Any help would be much appreciated
Maybe try using Get Velocity for velocity vectors instead of the character movement component velocity?
My workaround is to feed the velocity vector into the Launch Character function for things like this with a float multiplier from something like speed, so it scales realistically with whatever. Because yeah, the character just stops instantly when jumping from moving objects.
If I can’t get a reliable velocity from the owning actor, I’ll try and get it from the moving object and feed that vector into the same Launch Character function since my guy likes to act like he’s an immovable object when stepping off moving things. You can check Event On Movement Mode Changed to check the Enum Is Falling and run your launch function there so if there is velocity then it’ll get some movement going in that direction.
Yeah make sense! I thought about doing the exact same with the velocity, but im not able to get velocity of my platform (which I move by using set world location) or from the CMC. It seems to work only when physics object is simulated… I can get the position at two different frames and calculate velocity, but it would be way simpler to just use the velocity calculations that used to work in previous unreal engine editions… the velocity stuff works in ue 5.3 but not in 5.4.
For now, the current solution seems to be using the position of the player at two different frames and calculating velocity manually, which is applied when the player leaves an object (this would be done by having a sphere collider in the player BP that has events for component begin/end overlap).
This is just a temporary solution, and I think it works better than getting the velocity of the object beneath the player because the solution can be entirely done by the player BP (meaning it is independent from any other objects - moving or not).
I’d just like to add on that it still does not work. (UE 5.4.1 -33305029)
I had a 5.0 project I ported up to 5.4 and it just - doesn’t work anymore. In comparing them the only tick box that changed with Character Movement was 5.4 adding “Based Movement Ignore Physics Base”, false by default. Neither true nor false fix this.
Doesnt work in 5.4.2 either. They added some new logic to the cmc for staying based while airborne, but this doesn’t affect the inherited velocity either… Just want to be able to read and use the inherited base velocity again… my bug submission has not been review yet, so please submit your own!
I’m not entirely sure what changed, but it seems like the root issue is that a component’s ComponentVelocity isn’t automatically updated in 5.4 (at least not when moving a component on tick in some manner). Since CMC’s GetImpartedMovementBaseVelocity calls GetMovementBaseVelocity which in turn calls GetComponentVelocity, this causes it to think the base component has no velocity.
GetMovementBaseVelocity also checks the owning actor’s GetVelocity. So, for now, one possible fix is to make sure either your base component’s GetComponentVelocity or your base actor’s GetVelocity returns the correct velocity. In our case, we manually tracked velocity then overrode GetVelocity to return it, since it made sense to do it at the actor level, but I think there’s a lot of approaches that could work, as long as one of those functions returns the correct velocity.
Exactly! Im trying to find the cause, but also hope that epic can fix it themselves. Since this worked in ue 5.3.2, it is a bit annoying that I have to find a custom solution for a feature in my game.
Hey guys. I was wondering the same thing and then I just downloaded the StackOBot sample project for 5.4 and noticed one thing. There are platforms in that project that use the “InterpToMovement” component which apparently gives the platform actual “movement” that translates to the character and thus the character can fly off the platform due to inertia. I even drew a debug arrow to confirm that the velocity of a jump follows an arc trajectory. There is, however, a “Stomper” actor that can push a character or disappear from under the feet. And that actor uses a timeline to set relative location for its movement. This setup gives the result when the character jumps straight up without any inertia coming from a mesh on which the character is standing while the mesh is moving. This whole situation gives me something to think about since I didn’t find any other explanation for why the platform can transfer its momentum to the character.
All of us should submit this as a bug, so that they can fix it asap. Its definitely a bug. I have already submitted, but doesnt seem like they have noticed it yet.
I’ve run into the same problem and i have a solution. Tick the checkbox “Stay Based in Air” in CharacterMovementComponent. Then you’ll be able to jump on a platform with inertia.
But if you want to get off the platform by walking off with inertia, you need some C++ changes (without source build). Override “virtual void UpdateBasedMovement(float DeltaSeconds)”, copy the previous function code and remove the last code segment(screenshot below)
It’s not really the inertia though. This option just constraints the player to that particular platform and as soon as you jump off it you’ll immediately lose that fake inertia as if you would jump from a stationary object. Also, naturally, you cannot jump at the end of the platform movement and fly off it retaining your initial momentum. That option feels like a gimmick or maybe some optimization for networking but it’s definitely not based on physics.
Update 1: I can confirm that StackOBot’s BP_MovingPlatform also provides inertia in my personal project. I just migrated it and it works with no problem. I guess I’ll try to recreate my own moving platform from scratch using the InterpToMovement component and see if this is truly a new way to do it or if I am missing something.
Update 2: I indeed recreated a very simple setup with a spline and InterpToMovement component and it works. I’m getting the proper momentum from the moving platform with this setup.
Update 3: I found a way to fix the issue, at least in my case. Hope that will help somebody else too. My platform has a pivot component which position interpolates between two points in space via timeline. A static mesh is a child of this pivot and just follows along. When I print Impaired Movement Base Velocity in the Character Tick event I don’t get any speed value changes from riding my default platform. I do however get the correct values from riding a platform created via the InterpToMovement component.
To make my default platform to update Impaired Movement Base Velocity I enabled the “Update Kinematic from Simulation” checkbox on the mesh that I ride on top in the Physics section of its details pannel. After that, everything works as it is supposed to.
I should clarify: I’m using the character movement component’s velocity before leaving a platform since they still work on ground. Then I just apply it to a vector variable to use as reference, feeding it back into the velocity component when leaving a platform.
The update kinematics from simulations solved it for me as well! Thanks… I was looking in the CMC for the solution. Do you have any idea what this setting actually changes? Thanks again for solving this for me!