2D Line Of Sight Detection System 1.0
This asset package contains scripts/prefabs to help you build you Canvas based 2D games that need line of sight detection with visible/invisible FOV cones. The asset includes 2 demo scenes one for top-down, one for sidescrolling behavior. The system is designed to be variable in it's performance impact and runs well on mobile as well on PCs.
The project has been developed with Unity 2019.3 but also works with 2019.2. Previous Unity Versions are not supported by the custom editor and the prefabs.
Features:
- Custom Editor for easy setup
- Multiple options to tailor the performance for your target (Mobile/Desktop)
- Highly customizable
- Variable FOV from 1° - 180° degrees
- Variable detection distance
- Automatic rotation from 1° - 180° degrees to the left/right (can stop on detection) with variable speed
- The FOV cone can be set to visible/invisible
- Color for detected/undetected can be set and animated
- Custom sprites for detected/undetected state can be set for the FOV cone
- Multiple tags which trigger detection can be set
- Multiple layers on which the raycast for the line of sight detection is being made can be set
- Raycast only happens when a target object enters the detection radius of the search object
- Detection interval (when the raycast is made) can be set between 0.1 and 5.0 seconds to save on performance
- The density of the rays used for the raycast is variable to save on performance
- The search direction can be toggle from middle to the outside or outside to the middle
- In the editor debug rays can be drawn during gameplay to help debugging gameplay
- Custom Unity Events can be added via the editor when an object is detected or has been lost by detection. The events pass the GameObject of the detector as well as the detected object to easily implement further functions
- Helper function to rotate elements with the FOV cone is included
此资源包包含脚本/预制件,可帮助您构建基于 Canvas 的 2D 游戏,这些游戏需要使用可见/不可见 FOV 锥体进行视线检测。 该资源包括 2 个演示场景,一个用于自上而下,一个用于横向滚动行为。 该系统被设计为对性能的影响是可变的,并且在移动设备和个人电脑上都运行良好。
该项目是使用 Unity 2019.3 开发的,但也适用于 2019.2。 自定义编辑器和预制件不支持以前的 Unity 版本。
特征:
- 自定义编辑器,方便设置
- 多种选项可根据您的目标(移动/桌面)定制性能
- 高度可定制
- 1° - 180° 范围内的可变视场
- 可变检测距离
- 变速自动旋转 1° - 180° 向左/右(可在检测到时停止)
- FOV 锥体可以设置为可见/不可见
- 可以设置检测到/未检测到的颜色并设置动画
- 可以为 FOV 锥体设置检测/未检测状态的自定义精灵
- 可设置多个触发检测的标签
- 可以设置用于视线检测的光线投射的多个层
- 仅当目标物体进入搜索物体的检测半径时才会发生光线投射
- 检测间隔(进行光线投射时)可以设置在 0.1 到 5.0 秒之间以节省性能
- 用于光线投射的光线密度是可变的,以节省性能
- 搜索方向可以从中间到外部或从外部到中间切换
- 在编辑器中可以在游戏过程中绘制调试光线以帮助调试游戏
- 当检测到对象或因检测而丢失对象时,可以通过编辑器添加自定义 Unity 事件。 事件通过检测器的GameObject以及检测到的对象轻松实现进一步的功能
- 包含使用 FOV 锥体旋转元素的辅助功能
页:
[1]