When To Use Reigion3 Over Raycasting?

So I’m currently making an attack for a project right now, and I was planning to use raycasting, but after thinking, my attack has an area of attack, and raycasting may not be the best.

Example:

Should I use Region3 for this, or should I stick with raycasting?

You could use Region3, but it’s deprecated. Instead use the new OverlapParams feature.

1 Like

Raycasting. Are you gonna create a region3 every time the player does an attack? Seems complicated

Edit: I suggest you cast multiple rays to cover up the area

You can’t just delete a reigion3?

Could you break the article down please, I’m kinda confused

Sorry about this, I’m still new to coding and professional articles still confuse me :sweat_smile:

Yes, you can. Just seems complicated.

But wouldn’t making multiple rays also be complicated?

Hmm, I guess it would add more lines to your code. Well, you could do it with Region3. Best of luck!

Edit: Could you just send one raycast and make the attack vfx cover the entire area? And then you could check whether the VFX is touching a player?

1 Like

OverlapParams is a new feature that allows integral raycasting, much like Region3, except it is far easier to work with and it was designed for better workflow. “OverlapParams” specifically, is a filter for possibly involved parts. Functions similarly to Raycasts, but with integrals.

Perhaps you should use OverlapParams for area damage as stated in the OP.

2 Likes

It really depends. There are a couple modules for raycast melee hotboxes but they are expensive to run.

If this is an area attack or a very large AOE attack you might want to use Region3 or if you want to have an accurate melee attack or projectile based use raycast.

As stated by other people, using Region3 is not recommended anymore, instead, the use of the new SpatialQuerry Api (OverlappParams) is. Functions such as worldroot:GetPartsBoundsInBox and worldroot:GetPartsBoundsInRadius replace the need for region3 in part detection.

4 Likes