Raycasting outwards in a half sphere shape

I’ve been trying to figure out how to fire multiple raycasts in sort of a half-sphere shape, like this image, but 3d.
image
A lot of the devforum posts ive seen when searching for this topic tend to just mention spherecasting, which is not at all what I want, so I was hoping someone could assist me with this.

1 Like

Can you afford to put any more constraints on what this check would do? That might let you use a easier solution. Right now the closest most general thing I can think of is searching a spatial hierarchy like an octree; but then you’d have to build and maintain that tree which is a lot of complexity.

It’s for a molotov type item, you throw it, it hits the ground and then raycasts in this pattern, and where ever the rays hit is where fire is placed.

In that case you can almost certainly get away with randomly “dropping” raycasts down from some point slightly above where it hits. Is what you want a way to generate random directions in a half sphere?

That would definitely be useful, but I do like having it be somewhat uniform with where the fire is placed. I actually could probably just find a post about raycasting in cone shapes instead and just work with it from there.

You could try all kinds of shapes and see what works. I would try a cone but also put a max distance from center on where fire appears, otherwise hitting the edge off a cliff might place fire very far abeam.

Yeah, I’ll definitely add a max distance. I think ill just fire raycasts in a cone shape 3 times, which would be a lot easier to do but it wont be perfect, but I’m fine with that.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.