# Sprit in front of 3d?

**URL:** <https://forum.makecode.com/t/sprit-in-front-of-3d/23173>\
**Category:** Help\
**Tags:** graphics-and-math\
**Created:** [October 9, 2023, 6:50pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173 "2023-10-09T18:50:14Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ultimategreg123](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ultimategreg123/32/9940_2.png) [@Ultimategreg123](https://forum.makecode.com/u/Ultimategreg123)\
**Post date:** [October 9, 2023, 6:50pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/1 "2023-10-09T18:50:14Z")

</div>

_Hi_, I was wondering if @AqeeAqee could help me with getting a 2d sprite over the 3d-ness… preferably in blocks if u can.

Thanks if you’re able to!

idk why I blurred that

---

<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 9, 2023, 10:13pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/2 "2023-10-09T22:13:08Z")

</div>

I hope I can, too.  
But that really depends on what kind of 3d sprite you want. We need define it exactly, before we can discuss the possibility.

---

<div class="post-metadata">

**Author:** ![Ultimategreg123](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ultimategreg123/32/9940_2.png) [@Ultimategreg123](https://forum.makecode.com/u/Ultimategreg123)\
**Post date:** [October 10, 2023, 7:12pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/3 "2023-10-10T19:12:30Z")

</div>

Ok, here’s the link for context, there’s a comment for the sprite that needs to be… um… un-3d’d? (idk how to say dat lol).  
[https://arcade.makecode.com/S13942-09823-98508-37753](https://arcade.makecode.com/S13942-09823-98508-37753)  
Thx if it is possible!  
**🙂**

---

<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 10, 2023, 8:39pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/4 "2023-10-10T20:39:08Z")

</div>

The red car sprite in raycasting world. that already in 3d, in one kinds of, a 2d texure in a 3d world with a angle according the angle between itself and player.  
What you want is to draw a different angle view of the car based on this only one image? If so, I have to say that’s a impossible task for any one. 😅

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [October 10, 2023, 8:46pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/5 "2023-10-10T20:46:04Z")

</div>

I think what he’s trying to say is make it so that the car doesn’t rotate to face you as you move around it, but rather stays 2d and facing one direction constantly.

That’s how I understood it.

---

<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:** [October 10, 2023, 9:32pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/6 "2023-10-10T21:32:02Z")

</div>

I was going to like this post, but then I ran out of likes. 😩

---

<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 10, 2023, 9:32pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/7 "2023-10-10T21:32:09Z")

</div>

Thanks for the explaination, that could be more reasonable, if it is.

---

<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 10, 2023, 10:07pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/8 "2023-10-10T22:07:02Z")

</div>

Just now learned that this was already built-in from the start by @AqeeAqee…:

> [@Raycasting 3D render -- Blocks Edition](https://forum.makecode.com/t/raycasting-3d-render-blocks-edition/12921/258):
>
> This feature has build-in from the first version, right? In the test file of this extension(main.ts), I set directional animations (a 2d image array) for each sprite.

Would love to see a best practice implementation of this by maestro himself, without wasting time on drawing many sprites at different angles!

---

<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 10, 2023, 10:17pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/9 "2023-10-10T22:17:11Z")

</div>

An extremely amateurish, crude and lazy hack attempt based on 4 gallery images:

> **[3d car game](https://arcade.makecode.com/92559-26806-83486-67510)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

(Sorry for the intrusion, much more 3D-competent guys, I just wanted to quickly familiarize with this great raycasting extension and the challenge at hand my self.)

---

<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:** [October 10, 2023, 10:21pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/10 "2023-10-10T22:21:40Z")

</div>

@Ultimategreg123, are you wanting something like this?

> **[3d car game](https://arcade.makecode.com/S34843-60315-10103-80879)**
>
> 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 10, 2023, 11:10pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/11 "2023-10-10T23:10:04Z")

</div>

Nice!

Of course this must be it!  
(@Ultimategreg123?)

> **For @Blobbey's eyes only...**
>
> Other than that, I am extremely happy that @Blobbey stepped by here, so that he can see with his own eyes from my two previous posts above, which clearly were moderated/approved by @makecode _in the incorrect LIFO/stack order_, thus proving, that I indeed beat him to the finish line in [the other thread](https://forum.makecode.com/t/sprites-across-different-tilemaps/23158), which, of course, was no competition either… 😉

---

<div class="post-metadata">

**Author:** ![Ultimategreg123](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ultimategreg123/32/9940_2.png) [@Ultimategreg123](https://forum.makecode.com/u/Ultimategreg123)\
**Post date:** [October 11, 2023, 3:07pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/12 "2023-10-11T15:07:17Z")

</div>

YES THANK YOU! @blobbey thx

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [October 11, 2023, 3:07pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/13 "2023-10-11T15:07:34Z")

</div>

Good work! I thought of recommending the relative to camera block but I was unsure of whether it would work

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [October 11, 2023, 9:04pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/14 "2023-10-11T21:04:38Z")

</div>

here is what id do  
first get the angle of the player and the car  
then if the car is in viue do the faloing  
find at what angel the car is facing based on the player and find what image to set the car to baset on that angle

---

<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 11, 2023, 9:38pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/15 "2023-10-11T21:38:37Z")

</div>

to: @Ultimategreg123 (not to Sage, sorry)

> [@Ultimategreg123](#):
>
> _Hi_, I was wondering if @AqeeAqee could help me with getting a 2d sprite over the 3d-ness…

> [@Ultimategreg123](#):
>
> YES THANK YOU! @blobbey thx

Can’t believe what you want is sprite relatived camera, why u call it 3d-ness?

---

<div class="post-metadata">

**Author:** ![Ultimategreg123](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ultimategreg123/32/9940_2.png) [@Ultimategreg123](https://forum.makecode.com/u/Ultimategreg123)\
**Post date:** [October 17, 2023, 8:47pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/16 "2023-10-17T20:47:59Z")

</div>

I … _er_… didn’t know what to say 😅

---

<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 17, 2023, 11:52pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/17 "2023-10-17T23:52:33Z")

</div>

alright 😂

---

<div class="post-metadata">

**Author:** ![Kiwiphoenix364](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kiwiphoenix364/32/14368_2.png) [@Kiwiphoenix364](https://forum.makecode.com/u/Kiwiphoenix364)\
**Post date:** [November 6, 2023, 10:23pm UTC](https://forum.makecode.com/t/sprit-in-front-of-3d/23173/18 "2023-11-06T22:23:22Z")

</div>

I had this reply drafted for like 2 weeks now and wasn’t quite sure how to word it, so it may be a bit confusing to read. But I may as well post it:

Could probably implement that with zig-zag wave function and scaling X, so when you are at a 90 or 270 degree angle to it, the (Xscale = 0), and when you are at a 0 degree angle, the picture looks normal (Xscale = 1), and when you are at at 180 degrees, the picture will appear backwards. (Xscale -1). So if the angle is 0-179 degrees, it is like mapping 0 to 179 to 1 to -1, then if the angle is 180 to 359 degrees, subtract 180 and then map the resulting value (between 0 to 179) from -1 to 1. This is not really a sine function though because that is more of a wave, this is more linear.
