Part of MyPawn:
void AMyPawn::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
if (!OnGround)
{
FVector temp = physiks.CalculatePhysiks(GetVelocity());
GetMovementComponent()->Velocity.Set(temp.X,temp.Y,temp.Z);
}
}
Part of myPhysiks:
FVector myPhysiks::CalculatePhysiks(FVector vel)
{
if (vel.IsNearlyZero())
{
return gravDirektion *gravity;
}
else
{
return vel += gravDirektion *gravity;
}
}
so i just want to simulat gravity and update my velocity at every tick but why is my velocity geting a reset to almost zero so that it dosent move unless i use the funktion AddMovementInput?