# How do I create a stable physics constraint between bones of different characters? 

**URL:** <https://forums.unrealengine.com/t/how-do-i-create-a-stable-physics-constraint-between-bones-of-different-characters/2626496>\
**Category:** Programming & Scripting\
**Tags:** physics-constraint, unreal-engine, CPP, question\
**Created:** [August 1, 2025, 2:53pm UTC](https://forums.unrealengine.com/t/how-do-i-create-a-stable-physics-constraint-between-bones-of-different-characters/2626496 "2025-08-01T14:53:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kinjambo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kinjambo](https://forums.unrealengine.com/u/kinjambo)\
**Post date:** [August 1, 2025, 2:53pm UTC](https://forums.unrealengine.com/t/how-do-i-create-a-stable-physics-constraint-between-bones-of-different-characters/2626496/1 "2025-08-01T14:53:19Z")

</div>

I’ve tried to setup a system to make 2 characters holding hands with a physics simulated constraint (visually similar to what Ico does). As soon as the hands are close enough, I run the following piece of code inside a character

```cpp
// Enable ragdoll for right arm
    GetMesh()->SetEnableGravity(true);
	GetMesh()->SetCollisionProfileName("Ragdoll");
	
	GetMesh()->IgnoreActorWhenMoving(TheOtherCharacter, true);
	GetMesh()->SetAllBodiesBelowSimulatePhysics(FName("upperarm_r"), true, true);
	GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(FName("upperarm_r"), 1.f);

// Create constraint
	HandConstraint = NewObject<UPhysicsConstraintComponent>(this);
	HandConstraint->RegisterComponent();
	HandConstraint->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepWorldTransform, FName("hand_r"));
	HandConstraint->SetDisableCollision(true);

	HandConstraint->SetConstrainedComponents(
		GetMesh(), FName("hand_r"),
		TheOtherCharacter->GetMesh(), FName("hand_l")
	);
	HandConstraint->SetDisableCollision(true);
	HandConstraint->ConstraintInstance.EnableProjection();

// Constraint configuration
	HandConstraint->SetLinearXLimit(ELinearConstraintMotion::LCM_Limited, MaxDistance);
	HandConstraint->SetLinearYLimit(ELinearConstraintMotion::LCM_Limited, MaxDistance);
	HandConstraint->SetLinearZLimit(ELinearConstraintMotion::LCM_Limited, MaxDistance);
	
	HandConstraint->ConstraintInstance.ProfileInstance.LinearLimit.bSoftConstraint = true;
	HandConstraint->ConstraintInstance.ProfileInstance.LinearLimit.Stiffness = LinkStiffness;
	HandConstraint->ConstraintInstance.ProfileInstance.LinearLimit.Damping = LinkDamping;
	
	HandConstraint->SetAngularSwing1Limit(EAngularConstraintMotion::ACM_Limited, 45.f);
	HandConstraint->SetAngularSwing2Limit(EAngularConstraintMotion::ACM_Limited, 45.f);
	HandConstraint->SetAngularTwistLimit(EAngularConstraintMotion::ACM_Limited, 20.f);

```

I tried varying the parameters MaxDistance, LinkStiffness and LinkDamping and I tried making the right hand heavier, but the arm explodes everytime.

![stream](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/1/e/31e4574b6b321efa18147693a171952d8b8fd392.gif)

What parameters might be causing this? Should I make all bones heavier?

---

<div class="post-metadata">

**Author:** ![kinjambo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kinjambo](https://forums.unrealengine.com/u/kinjambo)\
**Post date:** [August 1, 2025, 3:50pm UTC](https://forums.unrealengine.com/t/how-do-i-create-a-stable-physics-constraint-between-bones-of-different-characters/2626496/2 "2025-08-01T15:50:57Z")

</div>

I fixed it!

```auto
HandConstraint->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, FName("hand_r"));

```

Snapping the HandConstraint directly to the right location works! Now I have to balance the parameters to make it a bit more stable but the connection is fine. I also have created the reciprocal constraint on the left hand of the companion character to make it more natural
