Search Unity

Question RayPerceptionSensor2D Alternate Ray Order for maintaining spatial contiguity

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

  1. avbiswas

    avbiswas

    Joined:
    Jun 10, 2019
    Posts:
    7
    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:

    https://unity-technologies.github.i...ents/#grid-observation-summary-best-practices

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

    Ch1ckenNug

    Joined:
    Sep 14, 2021
    Posts:
    8
    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.