# What is the best way to add ray cast to observations? Learning Agents 5.4

**URL:** <https://forums.unrealengine.com/t/what-is-the-best-way-to-add-ray-cast-to-observations-learning-agents-5-4/1817197>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Learning-Agents, question\
**Created:** [April 23, 2024, 2:30pm UTC](https://forums.unrealengine.com/t/what-is-the-best-way-to-add-ray-cast-to-observations-learning-agents-5-4/1817197 "2024-04-23T14:30:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Delladep](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Delladep](https://forums.unrealengine.com/u/Delladep)\
**Post date:** [April 23, 2024, 2:30pm UTC](https://forums.unrealengine.com/t/what-is-the-best-way-to-add-ray-cast-to-observations-learning-agents-5-4/1817197/1 "2024-04-23T14:30:15Z")

</div>

Hello,

I’m currently working on training agents capable of navigating from point A to point B while avoiding obstacles. Currently, I’m employing Lane Tracing by Channel to generate an array of location and distance values describing each ray, simulating the agent’s vision. Subsequently, I construct a static array observation using this data. Is this the correct way to do this kind of thing??

Thank you!

---

<div class="post-metadata">

**Author:** ![Deathcalibur](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/deathcalibur/32/1037610_2.png) [@Deathcalibur](https://forums.unrealengine.com/u/Deathcalibur)\
**Post date:** [April 24, 2024, 1:25pm UTC](https://forums.unrealengine.com/t/what-is-the-best-way-to-add-ray-cast-to-observations-learning-agents-5-4/1817197/2 "2024-04-24T13:25:04Z")

</div>

Yes, that’s exactly how you would do it!

Specify:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/1/581098c51ecc74e67814de930d512fbea9cb2190.jpeg)

Make:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/f/16ffa392d6af94ab9b698cc08787c0c925de17e6.jpeg)

Let me know if that helps!  
Brendan

---

<div class="post-metadata">

**Author:** ![Delladep](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Delladep](https://forums.unrealengine.com/u/Delladep)\
**Post date:** [April 25, 2024, 7:33am UTC](https://forums.unrealengine.com/t/what-is-the-best-way-to-add-ray-cast-to-observations-learning-agents-5-4/1817197/3 "2024-04-25T07:33:47Z")

</div>

It works great! Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 25, 2024, 7:34am UTC](https://forums.unrealengine.com/t/what-is-the-best-way-to-add-ray-cast-to-observations-learning-agents-5-4/1817197/4 "2024-05-25T07:34:44Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
