RayCast2 is an easy to use, accurate and documented Raycasting module, specifically for Guis and 2D Game development. Its similar to how Raycasting works when using parts in Roblox studio. If you are into 2D game development, this module is for you!
Raycasting is a very beneficial concept. Read more about it on the wiki:
The module is used to detect hit points of the ray and can be used in ray tracing:
Why use RayCast2?
2D Game development engine features are not present in a wide variety in Roblox studio, therefore I created this module to ease development for some of you. This module is an accurate and easy to use ray casting module for guis.
"Oh thats easy to make! Why use it then?"
RayCast2 not only is accurate but also works with Rotated gui elements! You might question its accuracy. Take a look at this:
"Ha! What if there was another gui in front of that?!"
If there was. It’ll work as expected! It’ll strike the gui that comes in its way first!
"Hmm, that ray points in only 1 direction, what if I wanted to make diagonal rays??"
This module has got your back, it can cast rays in any direction! Look at this slanted ray!
There are several features and examples listed in the documentation and the post!
Raycasting on a 2D surface can be used in many areas of a 2D game. For example:
- Identifying obstacles
- Making AI
- Turrets
- Projectiles
- Hit detection
- Movement
- Other such mechanics
Module
The module is free to use, get the module here:
Documentation
This module is well documented. The documentation covers the api, debugging and troubleshooting. If you have any trouble with understanding how to use this module, feel free to send a PM or reply to this post, and I’ll help you as soon as possible.
Github
The source code for this module can be found here:
Planned Updates
RayCast2:CastWithIgnoreList()
- Faster algorithm to find the closest intersection of ray and guis
I am always excited to help the community out wherever I can. I am glad if this helped you in development. More from me soon! That’s all for today, see ya some time later folks!
Thanks!