I’m having an issue with the teleport destination not properly updating when using the motion controller. I am calling LineTraceSingleByChannel, then ProjectPointToNavigation. The exact same code using the HMD camera does update the destination marker, so I don’t understand why this is behaving differently. I also posted a video on the Facebook page showing the behavior. I am using Unreal 4.24 with an Oculus Rift S.
bool AVRCharacter::FindTeleportDestinationController(FVector& OutLocation) const
{
if (!DestinationMarker || !RightMotionController) return false;
FHitResult HitResult;
FVector Start = RightMotionController->GetComponentLocation();
FVector LookVector = RightMotionController->GetForwardVector();
LookVector = LookVector.RotateAngleAxis(30.f, RightMotionController->GetRightVector());
FVector End = Start + LookVector * MaxTeleportDistance;
bool bHit = GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECollisionChannel::ECC_Visibility);
DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 0.0f, 0.0f, 2.0f);
if (!bHit) return false;
FNavLocation NavLocation;
bool bOnNavMesh = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld())->ProjectPointToNavigation(HitResult.Location, NavLocation, TeleportProjectionExtent);
if (!bOnNavMesh) return false;
OutLocation = NavLocation.Location;
return true;
}