[Question] Detecting collision in ConstructionScript

I am adding instanced static meshes in my ConstructionScript but some of them overlap each other. Is there a way to detect if meshes are overlapping in ConstructionScript and delete them if they overlap? I tried a workaround that is:

1: Collect all the meshes that needs to check overlap event to a array in ConstructionScript

2: I plugged BeginPlay in EventGraph to a for loop that checks collision for each meshes in that array and binding each mesh to a Overlap event.

But when i begin play that Overlap event never gets fired.

Hey Satheesh,

Thanks for your report! We’re investigating this setup to find what would be the best solution for what you are trying to accomplish. Would you mind posting a screenshot of your setup for item #2 in your list?

Thanks!

-Steve

Sure. :slight_smile:

This is my setup in EventGraph. Number Of Meshes appears on screen and log but Collision Detected! print string never appears.

Hey Satheesh,

Thanks for the info! Hopefully one last question for this issue–could you also post a screenshot of your construction script, including where you’re populating your Instanced Static Meshes array?

Thanks!

-Steve

Sure. :slight_smile:

In my ConstructionScript am adding instanced meshes like this:

That Spawn Meshes On Sockets is a custom macro i created.

Hey Satheesh,

After talking with some programmers about the issues you’re running into here, we determined that there’s not enough functionality exposed for InstancedStaticMeshComponents in Blueprints currently. I have a entered a feature request to have functionality added so that you can, for example, track individually Added Instances (or add them to an array) so that you can modify their transforms after adding them, or delete them if unneeded (which would cover your case of wanting to delete any that happen to be overlapping), or otherwise manipulate them.

What I would recommend, in the meantime, that you use instead of Add InstancedStaticMeshComponent, is working with Add StaticMeshComponent for working with just your meshes or Add Actor to spawn blueprints that contain the Static Mesh(es) you are wanting to use. You will have access to be able to add all of the ones you spawn into an array and also check them individually against collision as well as work with their Sockets as you mentioned in another thread.

Finally, I wanted to note that you won’t be able to properly check Overlaps in the Construction Script itself, those can only be checked after the Construction Script has run when you are Simulating or Playing in Editor. I have a defect report in to have some functionality added that either disallows these functions (Get Overlapping Components and Get Overlapping Actors) from being added to the Construction Script or to have warnings thrown when trying to compile with them present in the Construction Script.

Thanks!

-Steve

Hi Steve,

Thank you for adding the feature request! :slight_smile: I am aware that Add StaticMeshComponent works but the reason why i want to stick with InstancedMeshes is because of performance. See below screenshot has all streetlamps and bus stops with InstancedMeshes and look at the FPS:

I changed the streetlamps and bus stops from Instanced to Add Static Meshes and now look at the FPS:

Now i do understand that there will be performance difference between Instanced and the usual Add Static Mesh method ([Jeff explained it][3]) so thats why i always want to stick with Instanced meshes when am generating the same model via Blueprint. :slight_smile: