Sixze / ALS-Refactored

Completely reworked and improved C++ version of Advanced Locomotion System V4.
MIT License
943 stars 261 forks source link

The Character jump on a MovingObject is not correct. #527

Closed watsonsong closed 1 month ago

watsonsong commented 2 months ago

The example object B_Als_MovingObject is SetWorldLocation in the tick event. But this way will not update the ComponentVelocity in SceneComponent. When the character jump on a moving object, it velocity is not correct. It seems should use a custom MovementComponent to implement the movement.

Sixze commented 1 month ago

I fixed this by setting bUpdateKinematicFromSimulation to true in moving actors, but for some reason ComponentVelocity will still return zero, so if you want to access the actual velocity, use the MovementBaseUtility::GetMovementBaseVelocity() function.

watsonsong commented 1 month ago

It can turn on the 'bStayBasedInAir' on CharacterMovementComopent, so the character jump on a movement base will has correct velocity automaticly. If don't want to turn on the 'bStayBasedInAir', I need change the movement object. I find only way is using c++. Implement a custom MovementComponent, and set 'ComponentVelocity' to the 'UpdatedComponent' and all it's children in 'TickComponent'.

Sixze commented 1 month ago

I reverted the fix because although bUpdateKinematicFromSimulation fixes the issue, it causes jitter when the character is standing on an up/down moving platform. This is a known issue introduced in UE 5.4

https://forums.unrealengine.com/t/ue5-4-character-movement-not-inheriting-velocity-when-jumping-off-of-moving-object/1838175 https://forums.unrealengine.com/t/get-physics-angular-linear-velocity-nodes-dont-work-for-bones-in-ue5-4/1820845