Line Trace by Channel against Box Collision - Problem

Hi Guys…
I am trying to learn UE4 currently and made already some interesting learnings.

But now I have a problem which I can not solve alone…
I am trying to make a tree which grows by time and if he reached his max size spawns other small trees randomly next to him.
It is nearly working.

I gave the tree blueprint a tree model component and a box collision component (which should be used for detecting regions where the tree may NOT spawn)
I calculate a random position within a min and max radius and than take this position + z 800 to make a line trace to the target position to calculate if one of the tree collider was hit (there is a own trace channel for this purpose, and the collider is set to block this trace channel)

But the trees even spawn in this collider :frowning:
I already tried a lot of stuff maybee someone of you could help me?

Have you checked if the box collision is set to “block all”?

The ForestChecking Channel’s default is Ignore.
But on the Box Collision Component I set the collision to custom.
The object type of the collision is WorldDynamic. All is set to ignore except ForestChecking, which is set to Block.
I thought that is the correct setting. So it isn’t?

Hi ,

what i would suggest you to Debug you collision is simply to link a function or a custom event in your event tick serie of node to allow you to display via UMG or even via Text component added on your Tree blueprint and get the collision channel and response from your object. It quite simple and it will allow you to check immediatly what is the channel and setting of your current actor collision.

Keep the good work !

I tried to make the debug output. Everything seems to be correct. The text was Custom like I set it.
I even tried to set collision object types and response channel via blueprint but the trees still spawn in the collider area :confused:

Hi ,
I’ve got a similar problem right now. Looks like the LineTrace function simply does not ‘see’ actors or components with custom trace channel that was set to Block inside Collision settings.

However, looks like this does not work with certain channels only. For me in my project only one ‘problematic’ channel appeared: the only one trace channel did not work, while other custom Channels were blocking the trace as expected.

The solution in this case for me was just to create a new custom trace channel and assign it to the LineTrace function and to component’s Collision settings as Block.

Cheers!

Hi Revenvik,
thank you very much for your awnser.
I’ll try this today in the evening and let you know if it works.

Tried it at work with a blank dummy project cause I couldn’t wait^^
Seems that the first channel was not working…
Than I added a second one and it realy works!
Now the other channel does also work :slight_smile:

So it could be a unreal bug?

Thanks for your help <3

You’re welcome :slight_smile:
Yeah, it looks like strange bug. At least it works in a very unintuitive way

My trace channel was penultimate in the trace list, but i’ve accidentally noticed, that other custom channels are working, so i’ve created the new channel and it was a workaround for me. Initially ‘bugged’ trace channel still does not work however.

Try checking blockall and work your way from it. It might help.

Didn’t even work with block all or custom set to only block…
At work with a reproduction project the fix was to create a new channel. But this fix did not work on my project at home.
But I fixed it now…
Strange behaviour… I put all the green nodes which calculated the random posotion in a new function and triggered this function before the line trace…
Then it worked o.O