The Detection Sensor provides the basic functionality required for visual object detection. It wraps a sensor and exposes a ray list, to which you can use for raycast. You can instantiate and assign the sensor yourself.
- Script automatically add visual components for editor.
- Adjust vertical and horizontal ray count.
- Adjust ray positions on scene.
[SerializeField] public DetectionSensor detectionSensor;
private DetectionRay[] _sensorRays;
private void Start()
{
_sensorRays = detectionSensor.Rays;
}
private void FixedUpdate()
{
for (var i = 0; i < _sensorRays.Length; i++)
{
var ray = _sensorRays[i];
if (Physics.Raycast(ray.Ray))
{
Debug.Log("Hit!");
}
}
}
You can add the code directly to the project:
- Clone the repo or download the latest release.
- Add the UnityDetectionSensor folder to your Unity project or import the .unitypackage
Contact : sefa@muveso.com