AutoSuccessRangeFromLastSeenLocation
AutoSuccessRangeFromLastSeenLocation
#Overview
name: AutoSuccessRangeFromLastSeenLocation
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AutoSuccessRangeFromLastSeenLocation is to define a range within which an AI agent can automatically detect a target that has been previously seen, without needing to perform additional sight checks.
This setting variable is primarily used in the AI perception system, specifically for sight-based perception. It is part of the Unreal Engine’s AIModule, which handles artificial intelligence functionality.
The value of this variable is set in the UAISenseConfig_Sight class, which is a configuration class for the sight perception sense. It can be edited in the Unreal Editor through the properties panel of an AI perception component or directly in code.
AutoSuccessRangeFromLastSeenLocation interacts with other sight configuration properties, such as LoseSightRadius and PeripheralVisionAngleDegrees. It’s used in conjunction with these properties to determine how and when an AI agent can detect targets.
Developers must be aware that:
- The default value is FAISystem::InvalidRange, which disables this feature.
- Negative values are automatically converted to FAISystem::InvalidRange.
- The value is stored in centimeters.
Best practices when using this variable include:
- Set it to a reasonable value based on the game’s scale and AI behavior requirements.
- Use it in conjunction with other sight configuration properties for balanced AI perception.
- Consider performance implications when setting this value, as a large value might lead to unnecessary detections.
- Test thoroughly to ensure it doesn’t create unintended behavior in AI agents.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:206, section: [/Script/AIModule.AISenseConfig_Sight]
- INI Section:
/Script/AIModule.AISenseConfig_Sight
- Raw value:
-1.f
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/AI/MLAdapter/Source/MLAdapter/Private/Sensors/MLAdapterSensor_AIPerception.cpp:119
Scope (from outer to inner):
file
function void UMLAdapterSensor_AIPerception::OnAvatarSet
Source code excerpt:
SightConfig->LoseSightRadius = 53000;
SightConfig->PeripheralVisionAngleDegrees = PeripheralVisionAngleDegrees;
SightConfig->AutoSuccessRangeFromLastSeenLocation = FAISystem::InvalidRange;
SightConfig->SetMaxAge(MaxStimulusAge);
PerceptionComponent->ConfigureSense(*SightConfig);
PerceptionComponent->RegisterComponent();
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Classes/Perception/AISenseConfig_Sight.h:42
Scope (from outer to inner):
file
class class UAISenseConfig_Sight : public UAISenseConfig
Source code excerpt:
/** If not an InvalidRange (which is the default), we will always be able to see the target that has already been seen if they are within this range of their last seen location. */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Sense", config, meta = (Units="Centimeters"))
float AutoSuccessRangeFromLastSeenLocation;
/** Point of view move back distance for cone calculation. In conjunction with near clipping distance, this will act as a close by awareness and peripheral vision. */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Sense", config, meta = (UIMin = 0.0, ClampMin = 0.0, Units="Centimeters"))
float PointOfViewBackwardOffset;
/** Near clipping distance, to be used with point of view backward offset. Will act as a close by awareness and peripheral vision */
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Perception/AISense.cpp:185
Scope (from outer to inner):
file
function void UAISenseConfig_Sight::PostEditChangeChainProperty
Source code excerpt:
void UAISenseConfig_Sight::PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent)
{
static const FName NAME_AutoSuccessRangeFromLastSeenLocation = GET_MEMBER_NAME_CHECKED(UAISenseConfig_Sight, AutoSuccessRangeFromLastSeenLocation);
Super::PostEditChangeProperty(PropertyChangedEvent);
if (PropertyChangedEvent.Property)
{
const FName PropName = PropertyChangedEvent.Property->GetFName();
if (PropName == NAME_AutoSuccessRangeFromLastSeenLocation)
{
if (AutoSuccessRangeFromLastSeenLocation < 0)
{
AutoSuccessRangeFromLastSeenLocation = FAISystem::InvalidRange;
}
}
}
}
#endif // WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Perception/AISense_Sight.cpp:119
Scope (from outer to inner):
file
function UAISense_Sight::FDigestedSightProperties::FDigestedSightProperties
Source code excerpt:
AffiliationFlags = SenseConfig.DetectionByAffiliation.GetAsFlags();
// keep the special value of FAISystem::InvalidRange (-1.f) if it's set.
AutoSuccessRangeSqFromLastSeenLocation = (SenseConfig.AutoSuccessRangeFromLastSeenLocation == FAISystem::InvalidRange) ? FAISystem::InvalidRange : FMath::Square(SenseConfig.AutoSuccessRangeFromLastSeenLocation);
}
UAISense_Sight::FDigestedSightProperties::FDigestedSightProperties()
: PeripheralVisionAngleCos(0.f), SightRadiusSq(-1.f), AutoSuccessRangeSqFromLastSeenLocation(FAISystem::InvalidRange), LoseSightRadiusSq(-1.f), PointOfViewBackwardOffset(0.0f), NearClippingRadiusSq(0.0f)
{
AffiliationFlags = FAISenseAffiliationFilter::DetectAllFlags();