Which is more expencive line trace or get overlapping actors / slow compile?

This is kind of two questions, hope that doesnt break any rules.

Situation:
My level is divided into 50x50 squares and planters are set to snap to these squares. the planters consist of a soil bed, (a plane) and 4x side static meshes, rotated to be on each side of the plane. If two are placed next to each other the side meshes between them is set to not visible.

I currently have the functionality of this set up like this.

After that is done I use a box overlap to get all overlapping actors and do the same check on them. as seen here:

This ALL works but It occured to me that i could just use the overlapping box to calculate all of this by using a for each loop and checking if they are in range (+50+50, +50-50, -50-50 and -50+50).

Anyway. I was just wondering if that would be a cheaper way of doing those calcs?
I have found that this specific blueprint (Which doesn’t contain a whole lot more than you see here) takes about 45 seconds to compile, while others (some more complex,) are instant. I’m wondering if the line traces are the issue?

So 1: which is cheaper
line trace > hit actor > is valid?
or
overlapping actors > for each loop > in range?

and 2 can you see anything in my code here that could suggest an alterantive reason for slow compile times?

Currently i think there are a maximum of 32 line traces happening at each player interaction (The repetition of this is limited to how fast the player can move the mouse to the next square and click).

appreciate any help.

About the compile time, i don’t think whichever method you use really impacts the compile time, and about the runtime speed, im pretty sure overlapping actors method is either the same speed or very close, but should be a lot faster to implement. So i recommend using overlapping actors instead.

Thanks, i ended up redoing the blueprint using the line traces and MASSIVELY simplified everything to work of just the origional 4. Appreciate the help.

Well actually, overlap is NOT cheap. It is really expensive, we generally try to avoid using overlap on VR projects since our aim is 90+ FPS.

2 Likes

Isn’t the vector math for line trace and overlap (for simple collision meshes like sphere or box) very close? Or am i wrong? Because you know, linetrace still uses a collision check, but just on the other actor, not the trigger actor.

If trigger actors collision is something simple like sphere or capsule or box, i dont think there is that much difference (Not enough to completely abandon it and increase the workload twicefold unless its a specific case like in VR i guess)

1 Like