I would like to extend the first person template character to achieve the following hierarchy through a C++ blueprint class:
-Character
–Capsule
—Camera
----GunPivot
-----ProjectileSpawnPoint
To achieve this, I’ve added the following lines in the class header:
UPROPERTY(VisibleDefaultsOnly)
class USceneComponent* GunPivot;
UPROPERTY(VisibleDefaultsOnly)
class USceneComponent* ProjectileSpawnPoint;
And this in the constructor of the class:
GunPivot = CreateDefaultSubobject(TEXT(“GunPivot”));
GunPivot->SetupAttachment(FirstPersonCameraComponent);
ProjectileSpawnPoint = CreateDefaultSubobject(TEXT(“ProjectileSpawnPoint”));
ProjectileSpawnPoint->SetupAttachment(GunPivot);
My expectation was that the ProjectileSpawnPoint component would become a child of GunPivot component, but for some reason, it becomes the child of the Character. Can anyone explain the cause?