Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question RayPerceptionSensor2D Alternate Ray Order for maintaining spatial contiguity

Discussion in 'ML-Agents' started by avbiswas, Mar 20, 2023.

  1. avbiswas


    Jun 10, 2019
    So I wanted to use a RayPerceptionSensor2D but it seems the default array order it returns is [0, -delta, delta, -2delta, 2delta....] , but I want to use a 1D-CNN and I want the output to be in the order [-ndelta, -(n-1)delta, ..., -delta, 0, delta, ..., (n-1)delta, ndelta].

    It seems that this is possible to do with setting an attribute called Alternating Ray Order in the RayPerceptionSensor2D component, as stated here:


    However, I can't find that option in Unity from the editor at least. Any idea how to do this easily?
  2. Ch1ckenNug


    Sep 14, 2021
    Hey, I know this is really late, but just to help anybody that comes across this in the future, the issue is probably that you aren't updated. I believe this is a new feature. Recently I updated my mlagents version to 2.3.0 and this suddenly appeared. To get the latest version, download the project from GitHub then upload the package JSON file to the unity package manager. You can probably find a tutorial for this somewhere online.