Set Simulate Physics and AttachActorToComponent Problem

Something seems to go wrong when trying to use Physics on an Actor and then trying to attach it to another’s mesh. In my case, I have an Actor where I set the “Set Simulate Physics” to true in the construction script. At some point I try to “AttachActorToComponent” the mentioned Actor to the Mesh of my Character Blueprint (at a particular socket in the mesh), and nothing happens. However, if I remove the “Set Simulate Physics” to false inside the construction script, everything works fine. Further, I try to disable “Set Simulate Physics” right before the “AttachActorToComponent” call, but it still doesn’t work - In other words, if i set “Set Simulate Physics” to true, even if it’s only once, I can never get the target Actor to attach to the component.

All of the above was done in blueprints.

1 Like

One thing to remember is that you should never try to use physics calls and translate calls in the same frame. This goes for attachments and enabling/disabling physics too.

What you’re doing is fine, just wait a frame after you disable physics before attaching the actor.

I used a Delay node set at 0.5 and it did not work.

Hi hardballs,

Could you post some screenshots showing us your blueprint setup?

I attached my construction script for an Item, which is where is set simulate physics to true. Inside the character blueprint, once a client presses a key, it will disable the simulate physics and do other logic.

The main issue has to do with your Component hierarchy for the Item blueprint. When you set the Body to simulate physics the root stays where it was placed. When you pick the item up it is the root of the blueprint that is attaching to the player.

I suggest making the Body the root component (or an invisible dummy component) and your setup will work fine.

2 Likes

TJ, I can’t thank you enough for your input. This also fixed other issues I was having in my object inheritance hierarchy - I had some hacks cooked up to patch them up.

Apologies for the mistake.

I wanted to bump this since this is such an important issue. It took me several hours to find this very simple fix. Thanks alot, TJ!

I cant spawn actors on the map when I delete the scene

I cant spawn actors on the map when I delete the scene

Thank you! I literally spent all day, only to find out that the fix only takes 1 second. :joy: