コード例 #1
0
bool UGameplayDebuggingComponent::ServerCollectNavmeshData_Validate(FVector_NetQuantize10 TargetLocation)
{
    bool bIsValid = false;
#if WITH_RECAST
    UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
    bIsValid = NavSys && NavSys->GetMainNavData(FNavigationSystem::DontCreate);
#endif

    return bIsValid;
}
コード例 #2
0
ARecastNavMesh* UGameplayDebuggingComponent::GetNavData()
{
    UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
    if (NavSys == NULL)
    {
        return NULL;
    }

    // Try to get the correct nav-mesh relative to the selected actor.
    APawn* TargetPawn = Cast<APawn>(TargetActor);
    if (TargetPawn != NULL)
    {
        const FNavAgentProperties* NavAgentProperties = TargetPawn->GetNavAgentProperties();
        if (NavAgentProperties != NULL)
        {
            return Cast<ARecastNavMesh>(NavSys->GetNavDataForProps(*NavAgentProperties));
        }
    }

    // If it wasn't found, just get the main nav-mesh data.
    return Cast<ARecastNavMesh>(NavSys->GetMainNavData(FNavigationSystem::DontCreate));
}