How to stop "Line trace" by channel going through walls ? (wall collision is set to block visibility)

Hi

I use line trace by channel to spawn different actors on the floor when aiming at it which works fine. But If there is a wall in between i can still spawn the actor behind the wall on the floor and i want to stop this from happening. How could i achieve it ? All i read so far about this is to set the collision setting on the wall itself to block “visibility”. This somehow does’t work for me :frowning:

I have different trace channels for my actors - those trace channels are set to “block” in the project settings…

Here is how the line trace looks like and the collisions settings on the wall where i want to stop the line trace going through it.



The wall itself has simple collision around it set in the mesh. Is there anything else i should set up for this ? Thx

Hi!

What trace channel you use here?

Is it Placement?
If so, then you need to set wall block this channel:

1 Like

No is not Placement :frowning:

Those channels used are FloorTrace, WallTrace and CeilingTrace.
The actors i am spawning on the walls use WallTrace. But the floor actors that i’m trying (which use the FloorTrace) to spawn are the one that i want to prevent spawning behind the wall. The problem is i cannot use “block FloorTrace” or the floor actors then start to appear on the wall itself which should not happen. I really need the line trace itself to stop when hitting a wall and thats it. All i read about is to just block visibility but it doesnt work on this. I guess the line trace itself from screenshot above do not use Visibility trace channel so it cannot be blocked that way. Only the 3 trace channels i write above.
Not sure how to make this work…

To give you an example how this works is i have floor actors so when aiming at the floor actor shows up. Aiming at a wall or ceiling do not show the floor actor at all. Same is with wall actors they only show up when aiming at a wall and nothing happens when aiming at the floor or ceiling with that wall actor its not visible… Same works with the ceiling actors. The only problem tough is that i can aim at the wall and build the floor actor on the floor behind the wall is if the wall wasnt there at all…

The line trace channel means the line itself.like what type is the line? by default it’s visibility line(visibility is just a name,not really visibility ).so when your actor’s collision set to ignore visibility,the line won’t hit the actor anymore.and when you added more trace channels,all actors collision settings would change accordingly so that you can have specific actors to ignore specific line.
Now your wall ignore the line.you should check what type of the line you’re firing.and check the wall collision to see if it ignores the line.

After more testing i found out that the problem isn’t really the line trace going trough the wall but it is more complicated because of the nature how this whole building system works. If i switch my floor actor’s trace channel to “Visibility” and then change the collision setting on the wall to “block” visibility it indeed stops the line trace on the wall and not going through it when aiming at it. But the problem is that i have a preview mesh of the floor actor on the wall when aiming at the wall which should not happen. It is this preview mesh that needs to be “fixed”. It should show up on the floor and if something blocking the floor actor it then turns to red but at the same time aiming on walls or ceiling should hide this preview mesh and not show up at all. This is the problem i acctually need to fix…

I was trying something with tags to build only on the floor for floor actors which works but the preview mesh still show up everywhere if i have the line trace set to “block”. So basicly i was trying to bypass this problem with ignoring the line trace but this don’t really solves the problem.
I will have to dig deeper and change this preview mesh to show up only on floor for this floor actors and on walls only for wall actors and so on somehow…

1 Like

I suggest that check the hit result.it always has the hit actor information.if it’s ceiling or wall then you could simply set the preview mesh to hidden.it’s a workaround ,but not sure if it fits your system.

1 Like

I was just trying to add tags there. But not sure if thats the way to go.
Here how this looks like atm on the line trace and after line trace where the preview mesh spawns…


1 Like