void ACharacter::LaunchCharacter(FVector LaunchVelocity, bool bXYOverride, bool bZOverride) { if (CharacterMovement && ((Role == ROLE_Authority) || IsLocallyControlled())) { FVector FinalVel = LaunchVelocity; if (MovementBaseUtility::IsDynamicBase(MovementBase)) { // Is this right? What if we are based on non root component and the root component has a velocity? Will it be lost? FinalVel += MovementBase->GetComponentVelocity(); } if (!bXYOverride) { FinalVel.X += GetVelocity().X; FinalVel.Y += GetVelocity().Y; } if (!bZOverride) { FinalVel.Z += GetVelocity().Z; } CharacterMovement->Launch(FinalVel); OnLaunched(LaunchVelocity, bXYOverride, bZOverride); } }
void ACharacter::LaunchCharacter(FVector LaunchVelocity, bool bXYOverride, bool bZOverride) { UE_LOG(LogCharacter, Verbose, TEXT("ACharacter::LaunchCharacter '%s' (%f,%f,%f)"), *GetName(), LaunchVelocity.X, LaunchVelocity.Y, LaunchVelocity.Z); if (CharacterMovement) { FVector FinalVel = LaunchVelocity; const FVector Velocity = GetVelocity(); if (!bXYOverride) { FinalVel.X += Velocity.X; FinalVel.Y += Velocity.Y; } if (!bZOverride) { FinalVel.Z += Velocity.Z; } CharacterMovement->Launch(FinalVel); OnLaunched(LaunchVelocity, bXYOverride, bZOverride); } }