@@ -88,39 +88,38 @@ AARCharacter::AARCharacter(const FObjectInitializer& ObjectInitializer)
8888
8989 Head = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Head" ));
9090 Head->SetupAttachment (GetMesh ());
91- Head->SetMasterPoseComponent (GetMesh ());
92-
91+
9392 Shoulders = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Shoulders" ));
9493 Shoulders->SetupAttachment (GetMesh ());
95- Shoulders-> SetMasterPoseComponent ( GetMesh ());
94+
9695
9796 Arms = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Arms" ));
9897 Arms->SetupAttachment (GetMesh ());
99- Arms-> SetMasterPoseComponent ( GetMesh ());
98+
10099
101100 Hands = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Hands" ));
102101 Hands->SetupAttachment (GetMesh ());
103- Hands-> SetMasterPoseComponent ( GetMesh ());
102+
104103
105104 Torso = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Torso" ));
106105 Torso->SetupAttachment (GetMesh ());
107- Torso-> SetMasterPoseComponent ( GetMesh ());
106+
108107
109108 Legs = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Legs" ));
110109 Legs->SetupAttachment (GetMesh ());
111- Legs-> SetMasterPoseComponent ( GetMesh ());
110+
112111
113112 Feets = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Feets" ));
114113 Feets->SetupAttachment (GetMesh ());
115- Feets-> SetMasterPoseComponent ( GetMesh ());
114+
116115
117116 Backpack = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" Backpack" ));
118117 Backpack->SetupAttachment (GetMesh ());
119- Backpack-> SetMasterPoseComponent ( GetMesh ());
118+
120119
121120 LegsCloth = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT (" LegsCloth" ));
122121 LegsCloth->SetupAttachment (GetMesh ());
123- // LegsCloth->SetMasterPoseComponent(GetMesh());
122+
124123
125124 WeaponHolsteredRight = CreateDefaultSubobject<UChildActorComponent>(TEXT (" WeaponHolsteredRight" ));
126125 // HolsteredRightWeapon->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepRelativeTransform);
@@ -150,10 +149,43 @@ AARCharacter::AARCharacter(const FObjectInitializer& ObjectInitializer)
150149 // Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
151150 // are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)
152151}
152+ void AARCharacter::OnConstruction (const FTransform& Transform)
153+ {
154+ Head->SetMasterPoseComponent (GetMesh ());
155+ Head->UpdateMasterBoneMap ();
153156
157+ Shoulders->SetMasterPoseComponent (GetMesh ());
158+ Shoulders->UpdateMasterBoneMap ();
159+
160+ Arms->SetMasterPoseComponent (GetMesh ());
161+ Arms->UpdateMasterBoneMap ();
162+
163+ Hands->SetMasterPoseComponent (GetMesh ());
164+ Hands->UpdateMasterBoneMap ();
165+
166+ Torso->SetMasterPoseComponent (GetMesh ());
167+ Torso->UpdateMasterBoneMap ();
168+
169+ Legs->SetMasterPoseComponent (GetMesh ());
170+ Legs->UpdateMasterBoneMap ();
171+
172+ Feets->SetMasterPoseComponent (GetMesh ());
173+ Feets->UpdateMasterBoneMap ();
174+
175+ Backpack->SetMasterPoseComponent (GetMesh ());
176+ Backpack->UpdateMasterBoneMap ();
177+ }
178+ void AARCharacter::PostInitializeComponents ()
179+ {
180+ Super::PostInitializeComponents ();
181+
182+ }
154183void AARCharacter::BeginPlay ()
155184{
156185 Super::BeginPlay ();
186+
187+
188+ // LegsCloth->SetMasterPoseComponent(GetMesh());
157189 WeaponInventory->SetIsReplicated (true );
158190 WeaponInventory->InitializeWeapons (this );
159191}
0 commit comments