Publisher | Golem Kin Games |
---|---|
File size | 2.45MB |
Number of files | 16 |
Latest version | 1 |
Latest release date | 2024-11-08 11:19:44 |
First release date | 2024-11-08 11:19:44 |
Supported Unity versions | 2018.4.2 or higher |
DistanceComparison System is a robust and efficient solution for calculating distances between objects in Unity, designed for developers seeking flexibility, performance, and ease of use. This tool leverages the Unity’s Job System and Burst Compiler for optimized parallel performance, this tool has you covered. With a custom editor for easy setup and configuration, DistanceComparison allows you to dynamically calculate distances between a player and multiple targets, visualize distance relationships in real-time using scene gizmos, and switch between traditional and job-based calculations based on your performance needs.
This system is ideal for AI movement, physics-based games, waypoint systems, or any scenario where object-to-object distance plays a key role.
Key Features:
- Job System Calculations: Use Unity’s Job System and Burst Compiler for high-performance, parallelized distance calculations.
- Single and Multi-Target Calculation: Easily calculate distances to a single target or an array of multiple targets.
- Custom Unity Editor: A user-friendly editor interface allows for quick setup, configuration, and testing, with buttons to trigger distance calculations and visualizations directly in the editor.
- Dynamic Gizmos: Visualize the distance relationships between the player and targets in real-time with customizable gizmo lines and spheres, perfect for debugging and game design.
- Configurable Parameters: Set the radius and color of the gizmo lines, toggle the use of the Job System, and dynamically assign player and target objects from the inspector.
- Optimized Performance: When using the Job System, take advantage of parallel processing to handle large numbers of distance calculations efficiently, making it suitable for both mobile and desktop games.
- Real-Time Testing: Test distance calculations in the editor with one click, and see the results directly in the console, making prototyping and debugging faster than ever.
Use Cases:
- AI Pathfinding: Efficiently calculate distances to nearby objects or waypoints for AI agents.
- Dynamic Game Worlds: Measure distances for in-game mechanics such as proximity-based triggers, detection systems, or event-driven interactions.
- Physics & Simulation: Use distance calculations in physics-based systems or simulations where proximity impacts behavior.
Additional Features:
- Customizable Center Point and Targets: Easily assign or modify the player and targets via the editor or at runtime.
- Cross-Platform Compatibility: Fully compatible with all Unity-supported platforms, including mobile, desktop, and WebGL.
- Optimized for Unity 2020 and Later: Leverages the latest Unity technologies, including Jobs and Burst Compiler, for maximum performance.
DistanceComparison System is a must-have tool for any developer looking to enhance their game mechanics, AI systems, or world-building with precise, efficient, and customizable distance calculations.
Patch Notes -
- Nearest and Farthest Target Detection:New Method: FindNearestAndFarthestTargets
Description: Finds and returns the nearest and farthest targets from the player. This is helpful for applications where prioritizing closest/farthest targets is important.
Callback Parameters: callback returns the nearest target with its distance and the farthest target with its distance. - Distance Threshold Callback:New Feature: OnThresholdCrossed event and CheckThresholdCrossing method.
Description: Added an event to trigger when a target crosses a specified distance threshold. Useful for triggering specific actions based on proximity.
Serialized Field: distanceThreshold allows setting the distance threshold value in the Inspector. - Distance Calculation Modes:New Enum: DistanceMode { Euclidean, Manhattan, SquaredEuclidean }
Description: Allows the selection of different distance calculation methods, including Manhattan distance and Squared Euclidean. This provides flexibility for different distance requirements.
Serialized Field: distanceMode allows setting the desired distance mode in the Inspector. - Dynamic Target Assignment:New Methods: AddTarget and RemoveTarget
Description: Allows dynamic addition and removal of targets at runtime. This is ideal for games where targets are frequently spawned or destroyed.
Internal Update: UpdateNativeArrays resizes the NativeArrays based on the current number of targets for job calculations. - Average Distance Calculation:New Method: CalculateAverageDistance
Description: Calculates the average distance of all targets from the player. This can be useful for analytics or adaptive gameplay adjustments based on proximity. - Weighted Distance Calculation:New Dictionary: targetWeights (Dictionary<Transform, float>) for associating weights with targets.
New Methods: SetTargetWeight, GetWeightedDistance, and CalculateWeightedAverageDistance.
Description: Allows the application of weights to specific targets, which affects the average distance calculation. This is helpful for scenarios where certain targets are more important than others.