Getting Physics Actors to Attach to Eachother during run time?

I am trying to get two actors to stick together during run time. The system I am trying to get to work has me place an original object (during runtime through a UI menu), which gets saved as a parent actor variable. Then, when I place the second object (also during runtime), I tell it to attach itself to the parent actor. Based on using F8 in the editor, I can see that the objects do weld together and move as one. However, I have a key that I press (G, for my case) that casts a function that causes all of the objects I have placed (as they are temporarily stationary, the building system I am using requires the objects to be motionless in a gridlike area of movement) to enable their physics. All of the actors are physics actors with their simulate physics turned off by default so that they do not cause issues when trying to build. Are they losing connections because of the simulating physics? If so, how do I work around this? I am fairly new to ue4 so I would appreciate a thorough explanation.
I attached a snip of my blueprints that attaches the two actors to each other.

Any help would be greatly appreciated. Thanks in advance.

P.S. The two actors are simple blocks. They do not have any sort of skeletal meshes or sockets.

I am not sure how you are enabling physics on the actors.
But! imagine you attach one actor to another, that makes one of the actors a child of the other one in their respective hierarchy. If you then call physics on both the parent and the child they will move independently from eachother because they are still seperate objects.
But since you attached the child to the parent the parent will take into account the size/mass of the child, so i think simply calling physics on the parent only instead of both will fix this issue :slight_smile:

3 Likes

Hello. Thanks for the suggestion. I tried it, and only the parent moved this time. I checked the tab that holds all of the actors, and it showed that the block was still a child of its parent (as shown below)

ParentChildUE4

Yet the 2x4x2BuildingAsset1 block remains floating in the air, while the parent drops to the floor due to gravity. Is there more information I should provide? If so, I will try my best to get you it so that we can figure this thing out.

Thanks in advance

Hmm,
Might be because you are attaching an actor to an actor?
Try attaching Static mesh components together.
I would also suggest just trying to do this manually in scene first to test if it works as suggested before adjusting blueprint. just make a blueprint with a static mesh parented to the other one and then simulate physics on the parent and drop it in the scene.
It should work that way.

I figured it out. A couple meshes were set to worldstatic instead of worlddynamic. Also, I did what you suggested, and only set the parent to enable physics.

Thanks for your help!

1 Like

Great!
Happy to hear that it worked out. :slight_smile: