Hey, so I have this movement system for my top-down character.
FHitResult Hit(1.f);
RootComponent->MoveComponent(Movement, TargetRotation, true, &Hit);
if (Hit.IsValidBlockingHit())
{
const FVector Normal2D = Hit.Normal.GetSafeNormal2D();
const FVector Deflection = FVector::VectorPlaneProject(Movement, Normal2D) * (1.f - Hit.Time);
RootComponent->MoveComponent(Deflection, TargetRotation, true);
}
Which works great!
However, I also need to do a similar collision check like while the player is not moving.
Basically the player can be on a moving platform (through attachment, which doesn’t count as moving for the code above).
So I wish to do this type of deflection movement when the player is on a platform as well.
But I’m at a loss where to start to get a suitable vector. Any suggestions?