Can I use ProjectPointToNavigation in C++?

You can find ProjectPointToNavigation in NavigationSystem.h

two definition for you

	bool ProjectPointToNavigation(const FVector& Point, FNavLocation& OutLocation, const FVector& Extent = INVALID_NAVEXTENT, const FNavAgentProperties* AgentProperties = NULL, TSharedPtr<const FNavigationQueryFilter> QueryFilter = NULL)

and

	bool ProjectPointToNavigation(const FVector& Point, FNavLocation& OutLocation, const FVector& Extent = INVALID_NAVEXTENT, const ANavigationData* NavData = NULL, TSharedPtr<const FNavigationQueryFilter> QueryFilter = NULL) const;

And you can use it with something like this

FNavLocation NavLoc;
FVector QueryingExtent = FVector(50.0f, 50.0f, 250.0f);
FNavAgentProperties NavAgentProps;
//Set you NavAgentProps properties here (radius, height, etc)
	bool bProjectedLocationValid = GetWorld()->GetNavigationSystem()->ProjectPointToNavigation(GetActorLocation(), NavLoc, QueryingExtent, MyNavData);

Hopes this helps

Cheers,

  • Marc
1 Like