Recently, I’ve encountered an issue with raycasting in order to check if a certain area is a valid placement point.
My building system is not a voxel based building system, and the main issue is that I need to check if a raycast intersects a certain area. Said area might not be on the ground, however. I can’t use Instance.new(), and caching parts would likely be a bad practice, because of the sheer amount. I can’t check different lengths of the raycast, because it would return nil at certain points simply because of the direction of the ray.
Here’s some visualization (O is an empty tile):
O O O O O
O O O O O
O O O O O
O O O O O
O O O O O
Let’s say that the player has their cursor pointed at the X:
O O O X O
O O O O O
O O O O O
O O O O O
O O O O O
Because my game is not voxel, this tile layout would be on all four sides of the player, including above their character and below their character, which is why detecting part touches would likely be too inefficient. The issue comes right here is that how am I going to detect where that is, because different raycast angles would cause different results every time when I check for a position.
Any help is appreciated, as I’ve been trying to solve this for a week now. If you need anymore information let me know and I’ll include it in the post.