Just tried that, no success. But I found throughout trail and error one working solution which seems to be not the correct way but somehow it works as expected:
Weapon.cpp
AWeapon::AWeapon()
{
PrimaryActorTick.bCanEverTick = true;
CollisionSystemComponent = CreateDefaultSubobject<UCollisionSystemComponent>(TEXT("Collision System"));
if(CollisionSystemComponent)
{
CollisionSystemComponent->SphereTraceStart->SetupAttachment(RootComponent);
CollisionSystemComponent->SphereTraceEnd->SetupAttachment(RootComponent);
}
CollisionSystemComponent.cpp
UCollisionSystemComponent::UCollisionSystemComponent()
{
SphereTraceStart = CreateDefaultSubobject<USceneComponent>("TraceStart");
SphereTraceEnd = CreateDefaultSubobject<USceneComponent>("TraceEnd");
}
So apparently when setting up the two USceneComponents TraceStart and TraceEnd from the parent Actor, it works. But if I try to attach those two inside of the Actor Component to the Root which is a static mesh, it wont do it. Very strangeā¦ Btw I changed also the CollisionSystemComponent from USceneComponent to UActorComponent.