蓝图节点
C++接口
/** Generates a random location reachable from given Origin location.
* @return Return Value represents if the call was successful */
UFUNCTION(BlueprintPure, Category = "AI|Navigation", meta = (WorldContext = "WorldContextObject", DisplayName = "GetRandomReachablePointInRadius", ScriptName = "GetRandomReachablePointInRadius"))
static bool K2_GetRandomReachablePointInRadius(UObject* WorldContextObject, const FVector& Origin, FVector& RandomLocation, float Radius, ANavigationData* NavData = NULL, TSubclassOf<UNavigationQueryFilter> FilterClass = NULL);
/** Generates a random location in navigable space within given radius of Origin.
* @return Return Value represents if the call was successful */
UFUNCTION(BlueprintCallable, Category = "AI|Navigation", meta = (WorldContext = "WorldContextObject", DisplayName = "GetRandomLocationInNavigableRadius", ScriptName = "GetRandomLocationInNavigableRadius"))
static bool K2_GetRandomLocationInNavigableRadius(UObject* WorldContextObject, const FVector& Origin, FVector& RandomLocation, float Radius, ANavigationData* NavData = NULL, TSubclassOf<UNavigationQueryFilter> FilterClass = NULL);
二者都是获取范围内一个随机位置,区别是
GetRandomReachablePointInRadius:一定可达。
GetRandomPointInNavigableRadius:不一定可达。例如在孤立平台上,随机到周围地面,实际上从当前位置到随机位置不可达。
参考
What's the difference between GetRandomReachablePointInRadius and GetRandomPointInNavigableRadius? In which case we should use which. - UE4 AnswerHub
|