SM_TableRound is set to no collision, which ignores the visibility channel.
Level blueprint spawns an actor and directs it to run the static mesh spawning event, and then performs two line traces on the visibility channel.
Spawning the static mesh component
On the left is the spawned static mesh which blocks the line trace, on the right is the same static mesh placed as a static mesh within the level which does not block the line trace.
This is a blank project created in 4.14.3, and then tested in both 4.14.3, and 4.15.
Sorry for the delay. This is because the level blueprint technically owns the Static Mesh Component that it is tracing to. If you disable the Ignore Self pin on the LineTraceByChannel node, it should work fine for you.
Let me know if that helps.
Hi TJ, the result is the same regardless of the ignore self setting. The issue is that the spawned mesh does not use the static mesh’s channel response settings.
It spawns with channels set to block, even if that’s not what is specified within the static mesh, and the channels must be manually set within the blueprint in order to get the desired result.
Could you provide a small test project with the issue you are seeing? I don’t seem to be getting the same results on my end.
This is the result I receive when I run the default map.
All you should have to do is set the Collision > Collision Preset > To ‘BlockAllDynamic’ on the static mesh that was placed into the level.
You are doing this on the spawned in static mesh component as well when you are calling the ‘AddStaticMeshComponent’ node. That’s why it is working for you.
Let me know if that helps.
The issue is that the spawned mesh does not use the static mesh’s responses, not the other way around.
I specifically set the static mesh to ignore all traces, it’s working as intended, the spawned mesh spawns with trace channels incorrectly set to block (presumably the project default), even though that is not what is specified within the static mesh.
Sorry for the misunderstanding. I see what you mean now.
This is because the AddStaticMeshComponent node you are using is overriding the defaults of the mesh. It’s no longer just a static mesh actor at this point, it’s being spawned in as a StaticMeshComponent. Which has it’s own defaults.
You will need to set the Collision there in order to have the spawned StaticMeshComponent to work as you expect.
Is there a particular reason why it doesn’t just use the static mesh’s settings?
In nearly every situation I can think of where I would want to spawn a mesh, I would have no reason to use values other than what the static mesh entity specifies.
Like I mentioned above, the StaticMeshComponent overrides the StaticMesh settings; and we do this because the component is it’s own thing and the static mesh can be swapped out on the fly if needed. If every time this is done, the static mesh would override the component settings, things could get messy.
For example; you can create many different StaticMeshComponents, all with the same StaticMesh being used but all with different settings. Once again; if the static mesh would override the component settings, things would get messy pretty quick.
Ah, I see that makes sense. Thank you.
Perhaps adding a flag to the set static mesh node to tell it to use the static mesh’s settings may be worth it. Setting the channels manually in the blueprint is a massive pain, and I’m sure I won’t be the only one to be confused as to why the channel responses aren’t matching up.