Hi there, i’m looking how to override the current velocity in a class base on UCharacterMovementComponent? I’m trying to override CalcVelocity() but i’m not sure if it is the function that I need?
I am looking for something like GetMaxSpeed() but for velocity.
void UPlayableCharMovementComponent::CalcVelocity(float DeltaTime, float Friction, bool bFluid, float BrakingDeceleration)
{
Super::CalcVelocity(DeltaTime, Friction, bFluid, BrakingDeceleration);
const APlayableCharacter* CharOwner = Cast<APlayableCharacter>(PawnOwner);
if (CharOwner)
{
if (CharOwner->GetIsDashing())
{
Velocity = CharOwner->GetDashVector();
}
if (CharOwner->GetIsGliding())
{
Velocity = CharOwner->GetGlideVector();
}
}
}
I tried to do that when i’m dashing(during a certain time) or when i’m gliding. The problem is that it’s not replicated over network and the velocity is null. The other problem is that i can put any value that i want on the Z axis, it stay at 0. Am I doing something wrong? Or am i just in the wrong part of the code?
Thanks for your help!