Existing alternatives to raycasting?

Hello again!

Getting to the point, I’m trying to make a storm chasing game. And for this, I’ve decided to make my own mesh-based clouds. But now I’ve run into a problem. With the large scale of clouds, storms, and tornadoes, I’ve had to bypass the size limit by using SpecialMeshes. These have gotten me very far so far, but now are unfortunately causing me a problem when it comes to raycasting.

I want to detect when the sun is obscured by a cloud and to darken the lighting accordingly and I have had success testing it with regular parts. But after testing with my real clouds and reading up on it, I’ve learned that raycasting only works when it interacts with a hitbox, which my SpecialMesh clouds do not have.

So far, my reading on the forum hasn’t given me anything hopeful or relevant as for a potential way to get around this issue, so now I’ve decided to post again. Are there any alternatives features/methods to raycasting that don’t rely on hitboxes? Or is this a feature that, until things potentially change, I should just shelve for later?

Thank you for your responses in advance!

What did you build your clouds in?

Maybe you can just cut them into smaller pieces then weld them in Roblox.

An Alternative to Raycasting would be to use Magnitude, which is getting the Distance between two Vectors

local distance = (startVector - endVector).Magnitude

if distance < amount then
    -- code
end
1 Like

There are 2 alternatives you can do that don’t use raycasting. One is you can change/darken the lighting when the cloud begins to obscure (if your code is made on a timed base sequence). The second thing is to have another hitbox where if this hitbox is touched by the cloud, proceed to darken the lighting.

Well, sinse you sacrified the use of MeshParts, the only way you could work around that would be creating your own table of vertices positions for that mesh (that is kindda like a real custom mesh file lol) and with that you can use math skills to know when does a line intersect with the area that your custom mesh data describes (custom raycasting). That is very unpractical though.

I would try:

  • lowering the polygons of your mesh and see if you can use them as a MeshPart
  • Use fake invisible flat parts or unions that the roblox’s raycast can easily get

I made them in Blender. I should have specified, I’ve made textures for these meshes that would require a lot of reworking to fix its look if I were to split it up a bunch. I’m not ruling this out quite yet, but I’d rather look for different methods first that preserve what I have.