Quick answer: Disable physics simulation and set Collision Enabled = Query Only (or NoCollision) on the held actor’s mesh before attaching to the character socket. PhysX won’t fight the attachment transform.
Player picks up a sword. The sword spawns at the hand socket but shakes violently, half-clipping into the character, jittering as if having a seizure. Detaching stops the jitter. Something in the held-state physics is contradicting the attachment.
What’s Happening Under the Hood
The sword has a SkeletalMeshComponent (or StaticMeshComponent) with a physics asset enabled for simulation — appropriate when it’s on the ground bouncing. When attached to a socket, two forces fight every tick:
- The attachment teleports the sword to the socket position.
- PhysX detects collision between the sword’s physics bodies and the character’s capsule, applies penetration resolution forces.
- Next frame, the attachment teleports it back.
The result is a sub-millisecond oscillation that reads on screen as flicker.
The Fix: State-Based Physics Control
void AWeapon::OnPickup(USkeletalMeshComponent* CharMesh, FName Socket)
{
USkeletalMeshComponent* WeaponMesh = GetMesh();
WeaponMesh->SetSimulatePhysics(false);
WeaponMesh->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
AttachToComponent(CharMesh,
FAttachmentTransformRules::SnapToTargetIncludingScale,
Socket);
}
void AWeapon::OnDrop()
{
USkeletalMeshComponent* WeaponMesh = GetMesh();
DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
WeaponMesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
WeaponMesh->SetSimulatePhysics(true);
WeaponMesh->AddImpulse(FVector(0, 0, 200), NAME_None, true);
}
The held state turns off simulation and disables physical collision (Query Only still allows line traces for hit detection on swings). The dropped state restores both.
QueryOnly vs NoCollision
QueryOnly: line traces and overlap events still work. Set this if your sword needs to detect what it’s hitting during a swing.
NoCollision: no queries, no physics. Set this if the sword is purely cosmetic in the held state. For a dual-state weapon (held = cosmetic, swinging = active hit), enable Query and disable it again around the swing animation via AnimNotify.
Don’t Forget Multiple Components
If your weapon has multiple components — sphere collider for pickup, mesh for visuals, particle attachment for FX — each may have its own collision setting. Audit all of them. The pickup sphere should be NoCollision while held; the mesh QueryOnly; FX irrelevant.
PickupSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision);
WeaponMesh->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
For Skeletal Physics Assets Specifically
If the weapon uses a complex skeletal physics asset (e.g., a chain weapon with multiple bones), iterate the bodies:
for (FBodyInstance* B : WeaponMesh->Bodies)
{
B->SetInstanceSimulatePhysics(false);
B->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
}
SetSimulatePhysics at the component level is supposed to propagate, but specific physics asset configurations sometimes don’t. The explicit loop forces every body.
Verifying
In PIE, pick up the weapon and watch closely. The mesh should sit perfectly stationary at the socket. Show the physics overlay with show physics to see the physics bodies — they should be present but flagged as non-simulating. Drop the weapon and confirm physics resumes.
“Attached objects need physics off. Otherwise the engine spends every tick deciding whether you meant attach or simulate, and the answer is shake.”
Always wrap the pickup-and-attach in a single function so future you doesn’t forget step (b).