Skip to main content

Condition_TargetDistance

Description

A condition command that evaluates the distance between Self and the Target. By default the distance is measured center-to-center against the Target entity's location. If S1 is set to Sphere, both actors' horizontal bounding radii (GetBoundRadius, an XY broad-phase approximation that ignores height and pivot offset) are subtracted, giving an approximate surface-to-surface gap (clamped to a minimum of 0). If S1 is set to Box, the distance is computed between the two actors' oriented boxes (B2CollisionHelper::Distance): 0 when overlapping, otherwise a symmetric approximate box-to-box gap that is an upper bound (never underestimates the true shortest distance).

Parameters

ParameterDescription
CompareTypeComparison operator: Equal, NotEqual, Greater, Less, GreaterOrEqual, LessOrEqual, InRange, OutRange.
S1Distance basis. Empty: center-to-center. Sphere: subtracts both horizontal bounding radii. Box: oriented box-to-box gap.
F1Distance threshold in centimeters. For InRange/OutRange, this is the lower bound.
F2Upper bound in centimeters for InRange/OutRange comparisons.

Examples

DescriptionCommandCompareTypeS1F1F2
Check if the distance between Self and Target is within 5000 cmTargetDistanceLessOrEqual5000
Check if the distance between Self and Target is between 30 and 50 cmTargetDistanceInRange3050
Check if Self and Target are more than 1000 cm apartTargetDistanceGreater1000
Check if Self and Target bounds are within ~100 cmTargetDistanceLessOrEqualSphere100
Check if Self and Target boxes are within ~100 cmTargetDistanceLessOrEqualBox100