I’ll share my code. The code for me is working perfectly. The method name doesn’t match but it’s basically the same code. Screenshot below as well.
If this isn’t working, close your editor and delete the binaries and Intermediate folder then launch the uproject again.
At this point it should be working. I should note my project is 4.26 but there should be little difference between the 2 projects.
bool AVRCharacter::GetTeleportLocation( FVector& OutLocation )
{
OutLocation = FVector::ZeroVector;
// calculate the direction in which the controller is pointing, applying a slight rotation to point the controller
// in the right direction. Use this instead of forward
FVector Look = RightMotionController->GetForwardVector();
// the start and end vectors for the line trace
FVector startVector = RightMotionController->GetComponentLocation();
// we have a hit, so we can teleport.
FPredictProjectilePathParams inParams( TeleportRadius, startVector, Look * TeleportSpeed, TeleportSimTime, ECollisionChannel::ECC_MAX, this );
inParams.DrawDebugType = EDrawDebugTrace::ForOneFrame;
FPredictProjectilePathResult PathResult;
bool bDidHit = UGameplayStatics::PredictProjectilePath( this, inParams, PathResult );
if ( !bDidHit )
{
return false;
}
//UE_LOG( LogTemp, Warning, TEXT("HIT: %s"), *( hitResult.Location.ToString() ) );
FNavLocation OutNavLocation;
UNavigationSystemV1* NavSystem = UNavigationSystemV1::GetNavigationSystem( GetWorld() );
bool IsNavPossible = NavSystem->ProjectPointToNavigation( PathResult.HitResult.Location, OutNavLocation, TeleportExtents );
if ( IsNavPossible )
{
OutLocation = OutNavLocation.Location;
}
return IsNavPossible;
}