# How to find the player's direction with the raycasting extension?

**URL:** <https://forum.makecode.com/t/how-to-find-the-players-direction-with-the-raycasting-extension/27193>\
**Category:** Help\
**Tags:** game, graphics-and-math, extension\
**Created:** [February 22, 2024, 11:11pm UTC](https://forum.makecode.com/t/how-to-find-the-players-direction-with-the-raycasting-extension/27193 "2024-02-22T23:11:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hello1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hello1/32/20533_2.png) [@Hello1](https://forum.makecode.com/u/Hello1)\
**Post date:** [February 22, 2024, 11:11pm UTC](https://forum.makecode.com/t/how-to-find-the-players-direction-with-the-raycasting-extension/27193/1 "2024-02-22T23:11:04Z")

</div>

I’m trying to use Sprite Util extension’s angles to let the player shoot bullets in the direction they look with raycasting, but it lines up.  
how do you translate the raycasting direction variables into spriteutil’s directions?  
 ![direction](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/b/b3c9c2d366fb7329d3b6384dc338d58db8162c52.png)  
 ![direction2](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/7/7218da08def5cbf754822e556da8d185220d21ad.png)

---

<div class="post-metadata">

**Author:** ![Blobbey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blobbey/32/20831_2.png) [@Blobbey](https://forum.makecode.com/u/Blobbey)\
**Post date:** [February 23, 2024, 10:36pm UTC](https://forum.makecode.com/t/how-to-find-the-players-direction-with-the-raycasting-extension/27193/2 "2024-02-23T22:36:49Z")

</div>

I think you’re actually gonna want to use the normal velocity block. Just put the `dirX` block in the vx side, multiplied by whatever speed you want the projectile to go at, and do the same for the `dirY` and vy. I hope this helps! 🙂

---

<div class="post-metadata">

**Author:** ![Hello1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hello1/32/20533_2.png) [@Hello1](https://forum.makecode.com/u/Hello1)\
**Post date:** [February 26, 2024, 5:46pm UTC](https://forum.makecode.com/t/how-to-find-the-players-direction-with-the-raycasting-extension/27193/3 "2024-02-26T17:46:54Z")

</div>

omg thanks so much! i’ve been so puzzled at this for a while!

---

<div class="post-metadata">

**Author:** ![Lilvince](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@Lilvince](https://forum.makecode.com/u/Lilvince)\
**Post date:** [April 22, 2024, 4:54am UTC](https://forum.makecode.com/t/how-to-find-the-players-direction-with-the-raycasting-extension/27193/4 "2024-04-22T04:54:23Z")

</div>

how would I do this with an animation that is meant to follow where the player goes but ONLY right in front of them? I am also using the raycast extension
