Ray cast Observation for obstacles detection and Rewards

Hello everyone,
I’m looking for feedbacks on people who have used ray cast in observations, especially to detect obstacles.
How do you manage rewards based on raycasts?

We can add rewards based on hit functions, but in this case we don’t really need ray casts.

Any feedback is welcome :slight_smile:
Thanks

This could be useful: https://forums.unrealengine.com/t/what-is-the-best-way-to-add-ray-cast-to-observations-learning-agents-5-4/1817197

Thanks, the point is not how to add raycast on the observation, but if is it still need to add on the agent a Hit event

You can get the collision distance from the Line Trace raycast and then create a reward based on, for example, either the collision distance of the shortest ray or the mean of the distances. I’m not sure if that was the question.