# Raycasting collision not working

**URL:** <https://forum.makecode.com/t/raycasting-collision-not-working/23255>\
**Category:** Help\
**Tags:** extension\
**Created:** [October 13, 2023, 4:42pm UTC](https://forum.makecode.com/t/raycasting-collision-not-working/23255 "2023-10-13T16:42:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [October 13, 2023, 4:42pm UTC](https://forum.makecode.com/t/raycasting-collision-not-working/23255/1 "2023-10-13T16:42:01Z")

</div>

im coding a horror game most of it was made without the raycasting extension for better debugging when i added it the camera/player wont collide with walls or trigger traps and collectibles

ive tried a few things but i still cant get it to work

here is the game

> **[ai test](https://arcade.makecode.com/95958-86801-64563-24706)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [October 16, 2023, 6:29pm UTC](https://forum.makecode.com/t/raycasting-collision-not-working/23255/2 "2023-10-16T18:29:21Z")

</div>

Welcome to the forum, by the way, @ADM_F!

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [October 16, 2023, 7:01pm UTC](https://forum.makecode.com/t/raycasting-collision-not-working/23255/3 "2023-10-16T19:01:22Z")

</div>

It seems the destroying of all sprites of type Player in the clear all function messed up something regarding collision, don’t know what:

> **[ai test](https://arcade.makecode.com/92284-71079-26321-25269)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I also removed any occurrence of controller.move sprite, since it made the Player move awkwardly.

---

<div class="post-metadata">

**Author:** ![AqeeAqee](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/aqeeaqee/32/5424_2.png) [@AqeeAqee](https://forum.makecode.com/u/AqeeAqee)\
**Post date:** [October 16, 2023, 7:06pm UTC](https://forum.makecode.com/t/raycasting-collision-not-working/23255/4 "2023-10-16T19:06:36Z")

</div>

**Destory all sprites of kind Player** will remove the self sprite (Me in your project) from the phisical engine. Remove this block, walls will work.

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/5bbc1a561432d988df03c2ebc32fb35a18c864ce.png)

---

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [October 17, 2023, 9:32pm UTC](https://forum.makecode.com/t/raycasting-collision-not-working/23255/5 "2023-10-17T21:32:58Z")

</div>

Thank you! its working now and i cant wait to finish this project.
