Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Perception Sesnor 2D Hitting Agent

Discussion in 'ML-Agents' started by Jozzuph, Mar 25, 2023.

  1. Jozzuph

    Jozzuph

    Joined:
    Sep 12, 2019
    Posts:
    33
    I'm having trouble with the perception sensor 2D component. All characters in the game are set up with hitboxes. However, when I use this script, the agent's ray cast senses its hitbox and immediately stops. I've tried using detectable tags, but it seems this does nothing, as with an empty this, it still detects itself. How can I prevent the agent from detecting its own hitbox?

    The second problem is that if I remove all the layers, the rays work but are shot up in the positive y direction rather than the positive x direction. Is there a way to change their original direction?

    Thanks for the help, I am very new with ML agents so detailed descriptions would be awesome!