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.
  2. Dismiss Notice

Rewarding an agent when it "sees" something

Discussion in 'ML-Agents' started by Print_Hello_World, Aug 20, 2020.

  1. Print_Hello_World

    Print_Hello_World

    Joined:
    Jan 14, 2020
    Posts:
    12
    Hello :)

    I am trying to teach an agent to find a target but once it has "seen" the target, I want to give it a reward.

    I am using ray cast perception and I was wondering if there was any where to access the ray cast hit information shown in this script https://github.com/Unity-Technologi...ntime/Sensor/RayPerceptionSensor.cs#L211-L216 such that when a ray has hit an object of interest, I can reward the agent immediately.

    Any help is gladly appreciated. Thank you!
     
    kcfos likes this.
  2. NikeBless

    NikeBless

    Joined:
    Nov 17, 2020
    Posts:
    2
    Hey! I am trying to do the same thing, please say if you figured it out :)
     
  3. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    The easiest way to do that is to use the
    Detectable Tags
    list on the RayPerceptionSensor and just tag your target objects. Walkthrough. Documentation.
     
  4. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
  5. NikeBless

    NikeBless

    Joined:
    Nov 17, 2020
    Posts:
    2