Launch Character Inconsistent displacement

When I use the Launch Character node with ZOverride I would expect the same Z displacement if its triggered from on ground or while Falling.

image

If triggered while on ground, the velocity should be applied (eg. (0.00, 0.00 , 100)) and the character should be launched upwards with a velocity of 100 after which gravity will slow it down and it will land again.

If triggered while in the air with ZOverride on it should set the characters Z velocity to 0 and add 100, launching the charachter up from that point with a velocity of 100 after which gravity will slow it down and it will land again.

But instead, if it is triggered while falling the displacement upward is much less thann if triggered on the ground. Shouldnt the ZOverride ensure the same starting conditions here resulting in the same displacement?

Hey @TonyStarchXD , welcome to the forum!

Indeed, ZOverride and XYOverride change the velocity disregarding current velocity.

What it does internally after velocity is calculated is something like this:

Velocity = NewVelocity

The difference is that without override, the NewVelocity is equal to LaunchVelocity + Velocity, and with override it’s only LaunchVelocity.

So the resulting speed should be the same falling and on the ground with Override checked.

First you should try debugging the Velocity after the LaunchCharacter. Print it or log it to see if one has a different Z than the other or if it’s just a visual illusion (happens a lot).


Things to consider:

  • LaunchCharacter and all other functions that modify velocity with impulse (AddImpulse, AddForce, …) are not inmediate. The way it works is by telling the MovementComponent “hey, you have a PendingVelocity to change”, which is then handled by the Physics Engine.

Physics generally work on a different tick and usually after the logic, which means the change in velocity is not happening right when you call the function.

Calling different impulse methods can override or stack up velocity changes. In the case of LaunchCharacter, the PendingVelocity is overriden every time you call the function.

So, make sure the velocity is changed correctly. If it is not, make sure nothing else is changing the velocity before the Launch is applied.