Next: Turret Action, Previous: Targeting Computer, Up: AI [Contents][Index]
This component should be attached to a trigger that is parented to an AI. It provides target information to other AI components. To use most effectively, we recommend creating 4 collision layers (at least), one each for friendlies and enemies, and one each for friendly and enemy sensors. Then in the Physics Manager (Edit -> Project Settings -> Physics) make it so that the enemy sensor collides only with friendlies and vice versa for friendly sensor. This speeds up target detection, allowing more AI to be active at once. To further refine target lists, assign some target tags because anything not in that list is completely ignored.
string[] targetTagsWhat tags are we looking for while targeting? Any Game Object with one of these tags that is found will be passed as a target to the ’Message Receiver’ defined below.
bool targetRootShould we target the root transform of the object detected, or the object itself? Useful if colliders are parented to agents instead of being part of their root object.
Default value: false
bool checkLOSShould we check line of sight between the message receiver and the target? This requires a raycast, which queries the physics engine and can be expensive.
Default value: false
Vector3 rayOriginOffsetHow much should we offset the ray origin from the origin of the message receiver?
Default value: Vector3.zero
Vector3 rayTargetOffsetHow much should we offset the target point of the ray against the target we’re checking for LOS?
Default value: Vector3.zero
LayerMask obstructionMaskWhat physics layers can obstruct the view of this AI? This should NOT include the target!
bool chaseToLOSShould we try to get into line of sight if we don’t have it?
Default value: false
bool debugWARNING! SLOW OPERATION! Should we output useful information to the console?
Default value: false
string[] targetTagsWhat tags are we looking for while targeting? Any Game Object with one of these tags that is found will be passed as a target to the ’Message Receiver’ defined below.
bool targetRootShould we target the root transform of the object detected, or the object itself? Useful if colliders are parented to agents instead of being part of their root object.
Default value: false
bool checkLOSShould we check line of sight between the message receiver and the target? This requires a raycast, which queries the physics engine and can be expensive.
Default value: false
Vector3 rayOriginOffsetHow much should we offset the ray origin from the origin of the message receiver?
Default value: Vector3.zero
Vector3 rayTargetOffsetHow much should we offset the target point of the ray against the target we’re checking for LOS?
Default value: Vector3.zero
LayerMask obstructionMaskWhat physics layers can obstruct the view of this AI? This should NOT include the target!
bool chaseToLOSShould we try to get into line of sight if we don’t have it?
Default value: false
bool debugWARNING! SLOW OPERATION! Should we output useful information to the console?
Default value: false
Next: Turret Action, Previous: Targeting Computer, Up: AI [Contents][Index]