Raycasting... but in 2D!

Hello! Just tried to make raycasts… but in 2D! And I’m happy about the results and wanted to share it to see what others think of it, (maybe I can make a tutorial on it sometime in the future?). Anyways, here is the showcase. (Sorry for the bad quality!)

7 Likes

Very impressive! But I have 1 question about your system: does it use every ui object on screen to calculate ray, or it somehow do real raycasting?

Also, I’ll wait for your tutorial, if you will do it!

Well, I’m unsure about what you exactly mean but I’ll answer it from my understanding…

My system takes in 2 Objects, well, 1 actually, the ray origin is stored inside the Ray object, you will pass any other GuiObject and the system will calculate the intersection point between the ray origin and the GuiObject, the closest GuiObject is where the ray stops, it can raycast to lines only but that can be, easily, changed!

So I would say, yes, it does real raycasting.

If more people want it, I might make a tutorial, if not, I can discuss it with you in PMs!

4 Likes

I want to know how you did this because it’s insane, i don’t really know much about raycasting.

Wow, I’m impressed by how fast it actually seems.
This would be super useful for 2D games and whatnot!

If Roblox ever introduces an official and optimal way to make 2D games with sprites and everything, this would be VERY useful for projectiles and whatnot.

1 Like

@VSCPlays and @Cartoon_Corpze

Thanks for the nice words!
I’ll work more on the system and make a tutorial very soon!

(Project idea? :wink: :wink:)
Jokes aside, if Roblox adds 2D support, it will be such a great addition!

3 Likes

Should I make it possible to detect other objects and not only lines? I mean, lines are the building blocks of everything but ya.

1 Like

Amazing! A tutorial on how to do this would be great, since I currently want to port a 2D game I made on another platform to Roblox.

Alright! A tutorial will be coming very soon. It currently works between line segments only tho!

@VSCPlays @GamEditoPro @SubtotalAnt8185 @Cartoon_Corpze
The tutorial is out!

2 Likes