RayPerceptionSensorComponent3D detectable objects

Hi,
is there any way to find out which objects are hit by raycasts from agent using RayPerceptionSensorComponent? I want to make environment where 2 agents are playing something like hide and seek, so whenever one agent finds(detects with raycasts) other agent some action should occur.

hi. dont know if this can help you, but the RayPerceptionSensorComponent allow you to set with TAGS it should consider, you can for sure give agents different tags and let them also play in different Team Id in the behaviour.

as for my undertanding, the idea behing the rayperception is not a raycast to be used with IF afterwards (you can eventually creare your own raycasts for that), but to give the neural network more inputs to create a stronger environmental reference. it will be your behaviour, training, that will decide that if the raycast is having the “prey” in sight, it will have to react in a certain way, for the “predator” will be mostly the same…

i hope it will help

If you just need one agent being able to detect another, you could do a simple line of sight test. Instead of using the RayPerceptionSensorComponent and having multiple observables for a set of ray angles, you could do a single raycast between the two agents. This way, the observation would just be a bool (agent visible or blocked by obstacle) and a vector with the relative direction and normalized distance towards the opponent.