Wow thanks guys, that’s a lot of usefull information!
First of all, yep I’m dumb and tried to use NewObject() during the construction process of my PlayerCharacter.
Changing it to CreateDefaultSubobject<>() doesn’t do the trick, though.
I’m going to post the functions that seem to cause the hickup right here:
The one you allready know:
void URotationAnatomyMap::SetupNewComponent(FName InComponentName, float InPositiveYaw, float InNegativeYaw, float InPositivePitch, float InNegativePitch, float InPositiveRoll, float InNegativeRoll)
{
URotationAnatomyMapComponent* TempMapComponent = NewObject<URotationAnatomyMapComponent>(this); // This line was mentioned in the debug info, changed it still didn't work
TempMapComponent->SetRotationValues(InPositiveYaw, InNegativeYaw, InPositivePitch, InNegativePitch, InPositiveRoll, InNegativeRoll);
RotationAnatomyMapComponents.Add(InComponentName, TempMapComponent);
}
And the constructor of my PlayerCharacter:
APlayerCharacter::APlayerCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// Setting up the main camera
FPCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FPCamera"));
FName HeadSocket = FName(TEXT("head"));
FPCamera->AttachTo(GetMesh(), HeadSocket);
// Setting up the rotation anatomy map
RotationLimits = CreateDefaultSubobject<URotationAnatomyMap>(TEXT("RotationLimits"));
/* Setting up an rotation anatomy map component for the angles between camera and head.
* Values for Yaw and Pitch can be found here (source in german) [https://de.wikipedia.org/wiki/Augenbewegung#Leistungen_des_Bewegungsapparates]. Roll is just a guess...
*/
RotationLimits->SetupNewComponent(FName(TEXT("CameraHead")), 50.0f, 50.0f, 45.0f, 60.0f, 15.0f, 15.0f); // This line was mentioned in the debug info
}
Let me know if you need additional info!