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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question What does the RayPerceptionSensore3D compocent observe?

Discussion in 'ML-Agents' started by ikwing9, May 14, 2022.

  1. ikwing9

    ikwing9

    Joined:
    Apr 15, 2022
    Posts:
    1
    Hello
    I'm just learning about ML-agent.

    Does the "RayPerceptionSensor3D" component observe only tags and positions that have been hit by rays?
    Then, is it the same as adding the code below in the "CollectObservation" function?
    Code (CSharp):
    1. for(int i = 0; i < numOfRays; i++) {
    2.     rayHits[i] = Physics.SphereCast(each direction...);
    3. }
    4.  
    5. foreach(RayCastHit rayHit in rayHits) {
    6.     sensor.AddObservation(rayHit.collider.tag);
    7.     sensor.AddObservation(rayHit.collider.transform.position);
    8. }
    9.  
     
    Last edited: May 14, 2022
  2. jrupert-unity

    jrupert-unity

    Unity Technologies

    Joined:
    Oct 20, 2021
    Posts:
    12