A universal target tracking system that allows developers to centrally manage various target tracking requirements, especially suitable for enemy AI systems.
- Event-driven, performance-friendly
- Modular design, easy to extend
- Supports custom tracers to meet specific needs
-
Add the
TargetTraceSystemcomponent to your Actor. -
Configure the
Target Tracersdictionary, where the key is the name of the tracer, and the value is the tracer instance. -
Call the relevant methods of
TargetTraceSystemwherever target tracking is needed.Get Target Location: Retrieves the tracking result of the specified tracer by name.Add or Update TargetandRemove Target: Used to temporarily add or remove targets in the tracking system, typically for dynamic tracking needs. In most cases, these methods are unnecessary; it is recommended to use custom tracers instead.
Each time you call
Get Target Location, the system will locate the corresponding tracer and execute its tracking function. If you need custom tracking logic, you can implement it in a custom tracer. The process is simple: first, create a subclass ofTargetTracer:Then override the
Tracemethod, and the returned result will be the target's location: -
Freely extend the system's usage. For example, you can use it in an AnimNotifyState to get the player's current position and use it to create tracking effects for enemy attacks. Feel free to implement additional use cases based on your needs, and we welcome everyone to share their unique applications.
If you have any suggestions or ideas for improving this system, feel free to submit a pull request (PR)! We highly welcome and appreciate community participation and contributions. Please ensure your PR adheres to the following guidelines:
- The PR should include a clear description explaining the changes you made and their purpose.
- The PR should follow the code style and conventions to maintain consistency and readability.
- The PR should include necessary documentation updates to help others understand your changes.
This project is licensed under the MIT License. For details, please refer to the LICENSE file.





