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.