Class TargetedEntitySelector
Selects the caster's resolved target entity, validated by range — the EverQuest / WoW model.
[Serializable]
public class TargetedEntitySelector : TargetSelector
- Inheritance
-
TargetedEntitySelector
- Inherited Members
Remarks
Why this exists. Every other selector answers "what is in this volume", so its outcome is a function of where characters are at the moment the query runs. That makes it sensitive to the gap between where a client renders its peers and where the server holds them — measured at 0.45 m on a same-city connection and 2.2 m at 300 ms. A raycast is the worst case, having no width to absorb any of it.
This selector asks a different question: "who did the server decide the caster is aiming at". The answer is an entity reference, and the only positional test left is a range check with metres of tolerance. The outcome stops being a function of peer position, so it is correct at 8 ms and at 300 ms alike, with no rewinding and no history buffer. That is exactly how instant ranged attacks have always worked in EverQuest and WoW, and it is why those games never needed lag compensation for them.
Server authority. The target is whatever Current holds,
and on the server that was written by the server's own raycast from the replicated aim in
AbilityController.ResolveTargetAndSpawn. The client supplies a direction; the server
decides what is under it. A client cannot name its victim through this path.
Fields
EyeHeight
Vertical offset applied to both ends of the line-of-sight test.
[Tooltip("Eye height used for the line of sight test, so it does not clip the ground.")]
[Min(0)]
public float EyeHeight
Field Value
LineOfSightBlockers
Layers treated as sight-blocking when RequireLineOfSight is set.
[Tooltip("Layers that block line of sight. Should contain terrain and structures, not characters.")]
public LayerMask LineOfSightBlockers
Field Value
- LayerMask
MaximumRange
Maximum distance between caster and target for the ability to apply.
[Tooltip("Maximum caster-to-target distance. Generous by design; this is the only positional test.")]
[Min(0)]
public float MaximumRange
Field Value
Remarks
Re-checked here rather than trusted from acquisition time, because a target acquired at cast start can walk out of range during a wind-up. Generous by design — this is the only positional test in the path, and giving it metres of slack is what keeps the model latency-independent.
RequireLineOfSight
When set, requires an unobstructed line from the caster to the target.
[Tooltip("Require unobstructed line of sight to the target. Tests world geometry only, never characters.")]
public bool RequireLineOfSight
Field Value
Remarks
Off by default. The check is a raycast against world geometry — not against characters — so it does not reintroduce the peer-position sensitivity this selector exists to avoid. Terrain does not move, so no compensation is needed for it.
Methods
GetTooltipContribution()
Returns a short, designer-facing tooltip line describing this selector's targeting
(e.g. "Nearest enemy within 10m"), or null when the selector has nothing
to contribute. Override on selectors that have player-visible targeting semantics.
public override string GetTooltipContribution()
Returns
SelectTargets(EventData)
Selects targets based on the supplied event context.
public override IEnumerable<GameObject> SelectTargets(EventData eventData)
Parameters
eventDataEventDataThe event data driving the selection. Target (when set) or Initiator typically serves as the spatial origin.
Returns
- IEnumerable<GameObject>
The selected GameObjects.