Unreal 4.20 NavigationSystem changes

I checked out the repo for you and this is the output of the script

===================================================================================
./Source\ArchitectureExplorer\VRCharacter.cpp
-----------------------------------------------------------------------------------
8: #include "AI/Navigation/NavigationSystem.h" -> #include "NavigationSystem.h"
58:     bool bOnNavMesh = GetWorld()->GetNavigationSystem()->ProjectPointToNavigation(HitResult.Location, NavLocation, TeleportProjectionExtent); ->    bool bOnNavMesh = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld())->ProjectPointToNavigation(HitResult.Location, NavLocation, TeleportProjectionExtent);

Old -> New

Thank you for the effort. I am new to the forums and must first orient myself. Now a few mistakes have been added.

The contents of your .Build.cs file?

This solution worked for me, I’m using Unreal 4.24.1

Hi Everyone, after changing the build.cs file and the #include as explained in the video, this is how i believe the code for the function is supposed to be: (UE 4.25.4) – It runs ofc lol

(this is before the refactoring that starts on video time 14:18)

void AVRCharacter::UpdateDestinationMarker() 
{
	FVector Start = Camera->GetComponentLocation();
	FVector End = Start + Camera->GetForwardVector() * MaxTeleportDistance;;
	
	FHitResult HitResult;
	bool bHit = GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Visibility);
	
	FNavLocation NavLocation;
	bool bOnNavMesh = UNavigationSystemV1::GetCurrent(GetWorld())->ProjectPointToNavigation(HitResult.Location, NavLocation, TeleportProjectionExtent);
	
	if (bOnNavMesh && bHit)
	{
		DestinationMarker->SetVisibility(true);
		DestinationMarker->SetWorldLocation(NavLocation.Location);
	}
	else
	{
		DestinationMarker->SetVisibility(false);
	}
}
1 Like

concerning UE 5.3 issue. I didn’t find solution here. but due to helpful comments I managed my code to get working. here the link How to use C++ functions correctly in Unreal Engine? - Stack Overflow. but guy made one mistake.

UNavigationSystemV1* navSystem = NavigationSystem::GetCurrent
```TRUE is
UNavigationSystemV1* navSystem = FNavigationSystem::GetCurrent

Privacy & Terms