Search Unity

Unity ML Ray Perception Sensor

Discussion in 'ML-Agents' started by manolovivaylo016, Apr 24, 2021.

  1. manolovivaylo016

    manolovivaylo016

    Joined:
    Apr 20, 2021
    Posts:
    1
    Hello folks !

    I want to ask you guys about the Ray perception Sensor component. First lets begin what I want to do with it .

    I want to gather observations with the raycasts. Instead of writing

    Sensor.AddObservation( the goal I want to reach) I want the agent to add it automatically with the help of the rays. I want to do that because the position of the goal is going to constantly change and instead of adding it to the observation I want the ray to do it on its own . When you hit the goal tag you add It to your observation.I don't know if this is possible however that is why I'm asking how can we do this with ray perception component?

    If it is not possible , what is this class really doing. I can see the rays but what are they helping us with exactly ?
     
  2. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    Hi,
    If you have a RayPerception Sensor Component attached to the Agent, the observations will automatically be collected and processed by the Agent; you don't need to do anything else. You can see this in the WallJump example scene.

    Also note that you don't need to change the observation sizes in the Agent's Behavior Parameters when you add a SensorComponent.