# Help with raycasting collision

**URL:** <https://forum.makecode.com/t/help-with-raycasting-collision/44638>\
**Category:** Help\
**Created:** [June 21, 2026, 5:53pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638 "2026-06-21T17:53:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BitBot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bitbot/32/33272_2.png) [@BitBot](https://forum.makecode.com/u/BitBot)\
**Post date:** [June 21, 2026, 5:53pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/1 "2026-06-21T17:53:57Z")

</div>

In my game, the raycasting extension seems to not have collision. May somebody please help!?

@WoofWoof hopefully you can help because I see that you’re really smart with this type of stuff!

Link:

> **[Chippy's Arcade](https://arcade.makecode.com/92764-56197-02120-82256)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [June 22, 2026, 5:31pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/2 "2026-06-22T17:31:05Z")

</div>

It’s because you are destroying all sprites of kind player, destroying the raycasting engine’s hitbox.

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [June 22, 2026, 5:32pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/3 "2026-06-22T17:32:03Z")

</div>

Turns out you can accidentally destroy the player sprite and the only thing that happens is you lose collision!  
So basically, using this code I can see that the “myself sprite” in the raycasting extension is just using the default “player” sprite type:

 ![Screenshot 2026-06-21 at 2.26.37 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/2/32830a85d10d14da18ed2840582ecc591e1d1bc5.png)  
So when you destroy all sprites of kind player later…  
 ![Screenshot 2026-06-21 at 2.26.52 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/a/3ace3f0bd812778e29109f1365c9d9dd9260a709.png)  
It deletes the player sprite too! I suspect the only thing the sprite is used for is collision handling, which is why it doesn’t break the rest of the code when you do this.  
The fix here is pretty simple, just change the sprite’s type to be it’s own type that you won’t accidentally delete:  
 ![Screenshot 2026-06-21 at 2.36.45 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/1/b/1bc5a2717672938ad09d61807868609c6f9895b0.png)

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [June 22, 2026, 5:37pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/4 "2026-06-22T17:37:49Z")

</div>

Are you sure you put walls in the tilemap and the myself sprite does not have “ghost through walls” or “ghost” enabled at all?

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [June 22, 2026, 7:03pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/5 "2026-06-22T19:03:44Z")

</div>

Wow, I was totally stumped on what went wrong here, thank you for this fix! : - D  
There are quite a few other unanswered threads with this same question so I’ll spread the word!

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [June 22, 2026, 9:21pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/6 "2026-06-22T21:21:01Z")

</div>

I should probably get back in the habit of reading every help post…

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [June 23, 2026, 2:44am UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/7 "2026-06-23T02:44:44Z")

</div>

That’s my goal, too! (But for all topics.) I’ve actually watched your posts get approved to a topic _while_ I’m writing mine!  
It’s hard though, if you miss even a few days you can be way too far behind to catch them all 😆

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [June 23, 2026, 7:23pm UTC](https://forum.makecode.com/t/help-with-raycasting-collision/44638/8 "2026-06-23T19:23:42Z")

</div>

![IMG_2886](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/a/5/a552635f29fed165bc89f241ed1091ef96f65536.jpeg)  
Every once in a while I go through all of these to find interesting stuff, but I certainly don’t make clearing this list a habit 🫤 I mainly just enjoy cleaning up the help topics, and I avoid a lot of other random stuff. _ **cough** _ _the endless stream of new user hosted game jams_ _ **cough** _
