How to set weld simulated bodies in ComponentToComponent?

I want to set the following parameters in this function.

Target

Parent

Location

Rotation

Scale

weld simulated bodies

in the Following function.

SKMHair->AttachTo(GetMesh(),TEXT("Head"), EAttachLocation::KeepWorldPosition, true);

Also look in the BP function where the SKM_Hair is attached.

confused about what you are asking for

If you’re asking about WeldSimulatedBodies, that’s the part at the end of your arguments that says “true”, it tells the function to weld or not

But still the weld is not taking effect when in editor mode.
Only work in playmode.

i looked at SceneComponent.h and noticed that AttachTo is a depreciated function, they recommend using AttachToComponent instead, so this could be a possible reason why it works in-game but not in editor.

if that doesn’t solve the problem, then post here and we can look further

I saw you had multiple questions about this, did they solve the problem in those other questions?

All the solutions are only working in play mode, … not working in editor.
But BP is working perfectly

oh you want it to show up in the editor before you press play.

I thought you were saying it doesn’t work when you “Play in Editor” and it only works in Standalone Mode.

If you want it to show up in editor before you press play, you will have to attach the component in the Construction Script.

If you google “ue4 construction script” you can find documentation/tutorials. If you need further help, post here again.

Good luck on your game :slight_smile:

Yes, it need to attach in the Construction Script if using BP, but I am implementing this in C++ that’s why I face trouble :smiley:

You have to create a blueprint from your C++ class and drag that into the editor.

If for some reason you don’t want to make a blueprint, I googled “ue4 construction script c++” and found a bunch of threads about your issue and some workarounds.

It might just be better to expose your functions to blueprint and use the blueprint construction script, but it’s up to you.

Ok I will try those and will share feedback