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
| Parameter | Description |
|---|---|
| CompareType | Comparison operator: Equal, NotEqual, Greater, Less, GreaterOrEqual, LessOrEqual, InRange, OutRange. |
| S1 | Distance basis. Empty: center-to-center. Sphere: subtracts both horizontal bounding radii. Box: oriented box-to-box gap. |
| F1 | Distance threshold in centimeters. For InRange/OutRange, this is the lower bound. |
| F2 | Upper bound in centimeters for InRange/OutRange comparisons. |
Examples
| Description | Command | CompareType | S1 | F1 | F2 |
|---|---|---|---|---|---|
| Check if the distance between Self and Target is within 5000 cm | TargetDistance | LessOrEqual | 5000 | ||
| Check if the distance between Self and Target is between 30 and 50 cm | TargetDistance | InRange | 30 | 50 | |
| Check if Self and Target are more than 1000 cm apart | TargetDistance | Greater | 1000 | ||
| Check if Self and Target bounds are within ~100 cm | TargetDistance | LessOrEqual | Sphere | 100 | |
| Check if Self and Target boxes are within ~100 cm | TargetDistance | LessOrEqual | Box | 100 |
Back to Command FinderSearch and filter all 491 Script Condition documents