I am trying to set the relative location of a USkeletalMeshComponent (named Mesh1P) which is a property within my custom Character class. I am doing so from my custom Player Camera Manager class.
Within AMyPlayerCameraManager:
void AMyPlayerCameraManager::UpdateCamera(float DeltaTime) {
//Get custom character
AMyCharacter* MyPawn = PCOwner ? Cast<AMyCharacter>(PCOwner->GetPawn()) : NULL;
if (MyPawn) {
//The new location
FVector NewLocation = FVector(10.f, 10.f, 10.f);
//Set the skeletal mesh component's relative location to the new location
MyPawn->GetMesh1P()->SetRelativeLocation(NewLocation);
}
}
The code above does apply the new location, however immediately the relative location will return to [0,0,0], even if the original relative location (before SetRelativeLocation() was called) was not [0,0,0].
Why does this happen? How can I prevent this from automatically happening?