Does StaticMeshComponents added to an actor at runtime have collisions?

Hi,

I am hitting an issue where I am dynamically adding some staticMeshComponent to an actor during runtime.

So the new added StaticMeshComponent is set to have some physics collisions. However. It seems like when it spawns, it does not have any collisions.

Here are some screenshots of the AddStaticMeshComponent node and during the runtime when those SMC (StaticMeshComponents) are spawned but going through everything.

http://puu.sh/joEF3/3e28f4de35.png

http://puu.sh/joEHv/f854ad69d3.jpg

http://puu.sh/joEMO/6dfbdb1b1d.jpg

The only thing that comes to my mind would be it to treat it a SceneComponent or use a SceneComponent to link the SMC to the root… But I don’t think it has to do with this. I am a bit lost at the moment.

Is that normal? Is there a way to have those collide as well?

Thanks,

Erio

I believe that when dynamically creating components there is no collisions by default; however, even with collisions I (again) believe if you were to spawn an actor which overlaps the bounds of another actor, it will still give you the same results of them colliding. You can set collisions on a component just like you create the component. There are 3 nodes you can choose from: “Set Collision Enabled” “Set Collision Object Type” and “Set Collision Profile Name.” If you want to ensure that the newly spawned object is not colliding with another object in the world at spawn, just check for overlapping actors, which returns an array. See my image for an example of how I use it in my project. If it does overlap then you can do something to correct the overlap, i.e. adjust it’s coordinates (depending on how you are spawning them in will dictate what you need to do to adjust the spawn.)

Hope this helps, if not let me know and I will try to help again if I can. If it did help, it would be appreciated if you accept the answer by clicking the check mark located below the arrows next to the answer. Thanks!

I solved it ticking the “Auto weld” option in the Simulation menu, I think.

And we also discovered that scaling down a mesh was not scaling down it’s physX body. Which explained a lot of the weird behavior. :slight_smile:

Thanks for your answer though! It helped me a little bit as some things were also wrong with the channels (neededs to set them up manually for some reasons…)

What does exactly the “Set profile name” by the way please?
It is not clear on whether it does set the profile or “save it” under a custom name for runtime-time. :confused:

Thanks !

“Set Collision Profile Name” is the list you have when selecting collisions. It’s actually labeled “Collision Presets” when setting collisions - see image:

53015-collisionprofilename.png

But for some reason the node calls it “Profile Name”

Ah. Nice. Thanks for confirming me that’s what it meant! :slight_smile: