Lag when attaching actor to component

Dear Epic/Community,

I’m experiencing lag/jitter when attaching anything to a socket of a skeletal mesh.

Specifically, I have a static mesh and a skeletal mesh and I’m trying to connect the static mesh to a leaf joint socket of a skeletal mesh.
On doing so, the static mesh seems to lag behind the movement of the skeletal mesh.
The skeletal mesh has physics applied to it and is essentially a rag doll.

I have connected the 2 using Attach to Actor, Attach to Component and even sampling the skeletal mesh socket translation and applying to attachment on Tick.

It is almost as if the attachment only gets a translation every other frame.

I wonder if this is is rooted in to the physics engine for performance reasons?

Background behind what I’m doing: I’m trying to attach a hair mesh to a humans head. The hair and the body have to be separate.

Any help anyone can give would be greatly received.

Thanks,
James

Fixed it!

I just used constraints instead of Blueprint Attach to * nodes.

In web developer terms, it seems a constraint can be likened to animating with CSS, where as Attach to * can be likened to animating with JS

Please please please, tell me how you made the constaint, i’ve been messing around with physical constraints for 4 hours now and i’m just out of ideas… save me ;_;

Sure.

You can actually do it all in the GUI.

There’s a great tutorial on it here: Constraints User Guide | Unreal Engine Documentation

And/or here: Physics Constraint Component User Guide | Unreal Engine Documentation

On a side note, I found constraints to have a bit of lag as well!

This happened once the 2 skeletal meshes i was connecting had a lot of bones. Also make sure you don’t connect the child too far down the parent’s joint hierarchy (as this will make the problem significantly worse)

I ended up connecting my skeletons an meshes in Maya, prior to import.

I would only recommend constraints if you need to attach skeletal mesh actors at runtime (on an optional basis) and both of those objects do not have too many bones.

Thanks for the quick answer, i will try that out now!

Nope… i followed the instructions again and again and again, tried my own combinations, nothing works… :frowning:

Did you specify a bone for each skeletal mesh?

You should see a red and a blue (I think those colours are correct) box around each if you have selected the correctly, both with a corresponding line leading back to the constraint.

Also, make sure your objects are selected in the first place. I like to use the eye droplet tool

Having the same with weapon and IK bones when attaching left hand to it. Any solutions?

In case there’s anyone else having a similar issue, I found an alternate (C++) way of solving this problem that lets you keep the standard workflow of attaching meshes to sockets of skeletal meshes.

Call the below code in the Tick() function of the parent on the attached child mesh:

GetWorld()->Scene->UpdatePrimitiveTransform(AttachedChildMesh);

Not sure about the impact on performance, but this will force the transform to update earlier than it would normally and prevent jittering/attach update lag.

I had a similar issue where my socket attachments for a skeletal mesh were delayed for 1-2 frames. It was easy to observe using console command: t.MaxFPS 10

In my case, it was not a fix but mostly a work around. I had “Simulate Physics” which was ON, on the parent skeletal mesh, while I didn’t need it . Turning it off removed this delay.

In case anybody is curious, we are having this issue when you get a certain distance from 0 0 0. I am not certain the exact distance, but tested this with my 4k map earlier and proved this was the case. In another thread (click here) they go into the fix for this via C++ code

VIDEO PROOF: