Collision component wrong relative transform

Hi,
My problem is :
When I place or spawn my blueprint in the world, the collision component location is not the same as the root component.
What I try to do:
Detect collision using a box shape, represented by a particle effect (like a Fire wall for example)
What I did :
-Created a c++ class : AreaEffect, creating a particle system like such (constructor):

RootComponent = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("DefaultRoot"));
ParticleComp = ObjectInitializer.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("ParticleComp"));
ParticleComp->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);

-Created 2 other c++ classes inheriting from AreaEffect: AreaEffectBox and AreaEffectSphere because I was unable to make a shape selector I can use in the blueprint to switch between the shapes.

AreaEffectBox looks like this (constructor):

CollisionComp = ObjectInitializer.CreateDefaultSubobject<UBoxComponent>(this, TEXT("CollisionCompBox"));
CollisionComp->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);

-Created a blueprint AreaEffectFirewall inheriting from AreaEffectBox.
I can see in my blueprint the RootComponent, the ParticlesComp and the CollisionComp as inherited and I can change the values to my liking. I have only the default transform for ParticlesComp and CollisionComp. Looks ok.
But when I put AreaEffectFirewall in the world, the particles system is at the right location, but the collision component is at a very distant place (I suspect world origin). When I look at the transform inside the spawned CollisionComp, I see a translation. I dont know where it comes from.

Please help?

Cheers!

PS : Today I added to the blueprint AreaEffectFirewall, in the construction script, a node to set CollisionComponent relative translation to (0,0,0) and it worked, the component is in the right place. Doing that in c++ seems not to change anything…still need the c++ version.

Hey Stalker474-

In your AreaEffectBox class, since you havn’t explicitly defined your RootComponent I would instead try using a GetRootComponent() call to ensure that CollisionComp is attaching to the correct component. You may need to remake your blueprint and place new instances in the viewport for this changes to be visible. Another solution to try would be similar to the Set Relative Transform node you mentioned adding to the blueprint construction script. You can try setting the relative transform in the PostEditChangeProperty() function override to update the collision position. If you set relative transform in BeginPlay() instead you will not see the updated collision position in the editor however it should be correct when the game is running.

Cheers