I’m trying to replicate an UPhysicsConstraintComponent* and here is what ive done.
define it like this
||UPROPERTY(Replicated,VisibleAnywhere, BlueprintReadOnly, Category = Components)|
|---|---|
||class UPhysicsConstraintComponent* PhysicalConstraint;|
and ive added to list like this
||PhysicalConstraint = CreateDefaultSubobject<UPhysicsConstraintComponent>(TEXT(PhysicalConstraint));|
|---|---|
||PhysicalConstraint->SetAngularSwing1Limit(ACM_Locked, 0);|
||PhysicalConstraint->SetAngularSwing2Limit(ACM_Locked, 0);|
||PhysicalConstraint->SetAngularTwistLimit(ACM_Locked, 0);|
||PhysicalConstraint->SetupAttachment(RootComponent);|
||AddReplicatedSubObject(PhysicalConstraint);|
and then there is an interact function which i just change PhysicalConstraint components properties and set the constraint component
|||PhysicalConstraint->SetWorldLocation(*Player->GetHandLocation());|
|---|---|---|
|||PhysicalConstraint->SetConstrainedComponents(MeshComponent, NAME_None, Player->GetMesh(), FName(hand_l));|
what happens is that it sticks to players hand and since this code is being runed on server it sticks to the hand but it doesn’t replicate even though it follows the player as it should but since its being runed on server its lagging on client.