Hi,
Again, thanks a lot for the pointers and helpful advices
I did what you suggested and it solved the crash problem.
But from there on, things got weirder and weirder.
While the crash was gone, the attachment were still not working properly.
Plus, although the correct BP properties were defined (EditAnywhere, BlueprintReadWrite), the details panel of the component remained invisible in the editor, as if they weren’ marked as BP exposed.
So after having spent a few hours (trials/error passing parts of the code between the constructor and the BeginPlay function) to no avail, i decided to go for a flat and simple scheme: let the motion controller be a simple motion controller and put all the definition/logic in the parent actor, here, my PlayerController.
It can’t really get any simpler than this:
////////////////////////////////////////////
// LEFT HAND
////////////////////////////////////////////
// motion controller
mccHand_L = CreateDefaultSubobject<Ugen_MotionControllerComponent>(TEXT(“mccHand_L”));
mccHand_L->AttachToComponent(GetRootComponent(), FAttachmentTransformRules::KeepRelativeTransform);
mccHand_L->SetTrackingSource(EControllerHand::Left);// hand skeletal mesh
mccHandMesh_L = CreateDefaultSubobject(TEXT(“mccHandMesh_L”));
mccHandMesh_L->AttachToComponent(mccHand_L, FAttachmentTransformRules::KeepRelativeTransform);
mccHandMesh_L->SetRelativeLocation(FVector::ZeroVector);
mccHandMesh_L->SetRelativeRotation(FRotator(-90.f, 90.f, 0));ConstructorHelpers::FObjectFinder SkeletalMeshHand_L(TEXT(“/Script/Engine.SkeletalMesh’/gen_Game/HTAB/meshes/translucent_hands/TranslucentHand_L_UE4.TranslucentHand_L_UE4’”));
mccHandMesh_L->SetSkeletalMesh(SkeletalMeshHand_L.Object);// laser
laserMesh_L = CreateDefaultSubobject(TEXT(“laserMesh_L”));
laserMesh_L->SetStaticMesh(StaticMeshLaser.Object);
laserMesh_L->AttachToComponent(mccHandMesh_L, FAttachmentTransformRules::KeepRelativeTransform);
laserMesh_L->SetRelativeLocation(FVector(LASER_HAND_DISTANCE, 0.f, 0.f));
laserMesh_L->SetRelativeRotation(FRotator(-90.f, 0.f, 0.f));// laser hit
laserHitMesh_L = CreateDefaultSubobject(TEXT(“laserHitMesh_L”));
laserHitMesh_L->SetStaticMesh(StaticMeshLaserHit.Object);
laserHitMesh_L->SetWorldScale3D(FVector(0.02f, 0.02f, 0.02f));
Now the components and their hierarchy (who is attached to who) are properly defined, they show in the detail panel so i can check that everything (the meshes, etc.) is correctly setup.
But now, for some reason, although everything seems to be correct, nothing is showing in the viewport (and of course, nothing in game either).
The viewport stays empty as if nothing graphical was defined.
I can compile the player controller BP (created from my custom PC class) with no error, but when i save it (and restart the constructor), i get a bunch of scary messages in the output:
Exception thrown at 0x00007FFAB98D039C in UnrealEditor.exe: Microsoft C++ exception: wil::ResultException at memory location 0x000000242F81DDA0.
Exception thrown at 0x00007FFAB98D039C in UnrealEditor.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFAB98D039C in UnrealEditor.exe: Microsoft C++ exception: wil::ResultException at memory location 0x000000243039DA30.
Exception thrown at 0x00007FFAB98D039C in UnrealEditor.exe: Microsoft C++ exception: wil::ResultException at memory location 0x000000242F81DE10.
Exception thrown at 0x00007FFAB98D039C in UnrealEditor.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Probably related to my problem, but i don’t know what they mean.
The editor is not crashing, it’s just that nothing is displayed in the PC viewport.
I have been using this sort of code forever and never had any problem with it.
Is there some huge error in my code that is right in my face and i don’t see ? Wouldn’t be the first time
Thanks
Cedric