In a child of ACharacter, I want to offset a skeletal mesh component so its feet are in line with the bottom of a capsule component which has been scaled at runtime to the size of the character mesh being used. If I use SetRelativeLocation, the mesh resets to 0,0,0 reguardless of calling the function on the server and client. I’ve read that using SetRelativeLocation won’t work in a multiplayer game, and to change BaseTranslationOffset instread, but the property is protected and not accessible. (The post I read is here) https://forums.unrealengine.com/deve…esh-relatively
How do I change theBaseTranslationOffset of a character without editing the engine’s source code?
This is what I was doing before to offset a character (This is a UActorComponent attached to a child ACharacter class):
void UCharacterAssemblerComponent::InitializeCharacterAssembler(USkeletalMeshComponent* targetSkeletalMeshComp, FCharacterAppearance characterAppearanceVals, bool bEnableCharacterMode)
{
if (targetSkeletalMeshComp != nullptr && GetOwnerRole() == ROLE_Authority)
{
controlledSkeletalMeshComp = targetSkeletalMeshComp;
characterAppearance = characterAppearanceVals;
bCharacterMode = bEnableCharacterMode;
OnRep_UpdateCharacterMeshLocalOffset();
}
}
// RepNotify event for characterAppearance
void UCharacterAssemblerComponent::OnRep_UpdateCharacterMeshLocalOffset()
{
if (controlledSkeletalMeshComp != nullptr && bCharacterMode)
{
controlledSkeletalMeshComp->SetRelativeLocation(FVector{ 0.0f, 0.0f, characterAppearance.characterBody->GetBounds().BoxExtent.Z }); // According to UE_LOG, I get the correct float values here.
}
}