Can I use ProjectPointToNavigation in C++?

I’m just wondering if there is a C++ version of the blueprint function ProjectPointToNavigation. I’ve gone through the list of functions that a vector uses and PointPlaneProject is probably the closest to what I want to use (though at this point I’m not sure how to get a reference to a nav mesh plane).

1 Like

Is it project point to navigation for aicontroller?? If it’s like that i think it is a cpp function. Try to look at aicontroller function moveToActor and moveToLocation

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

Thank you!

Hello~ Can you please tell me where can I get MyNavData?
I search everywhere I have no clue for how to get them.

Thank you !

Hi. Where can I get MyNavData?