Construction script C++

Hello, need help. I need to write this code in C++.

I watched the tutorial videos and wrote the code.

void APersonazh::OnConstraction(const FTransform& Transform)
{
	Super::OnConstruction(Transform);
	ShtanyPersonazha->SetMasterPoseComponent(TeloPersonazha);
	RubashkaPersonazha->SetMasterPoseComponent(TeloPersonazha);
	KapushonPersonazha->SetMasterPoseComponent(TeloPersonazha);
	PerchatkiPersonazha->SetMasterPoseComponent(TeloPersonazha);
}

This code does not work for me and clothes are not worn on the character.

2

I don’t know what to do now, my game is in danger. Help solve this problem.

void APersonazh::OnConstraction(const FTransform& Transform)
{					  //^^^
	Super::OnConstruction(Transform);

If that’s the real copy-pasted code, then the first thing is to fix this typo in this function name, since this function won’t be called at all.

You could also find out this with a breakpoint, as it will never been hit in such case.

On the side note: those things are usually called: Body, Gloves, Pants, Head, etc. This way code would be more readable if you’d like to share it with anyone.

1 Like

Thanks, I got it. The code is correct. Just tell me why I need the line:

Super::OnConstruction(Transform);

Everything works without it.

void APersonazh::OnConstraction(const FTransform& Transform)
{
	//Super::OnConstruction(Transform);
	ShtanyPersonazha->SetMasterPoseComponent(TeloPersonazha);
	RubashkaPersonazha->SetMasterPoseComponent(TeloPersonazha);
	KapushonPersonazha->SetMasterPoseComponent(TeloPersonazha);
	PerchatkiPersonazha->SetMasterPoseComponent(TeloPersonazha);
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.