Hey Guys, I was trying to create a actor that contains both a particle system component and radial force components. However, once I spawn this actor, the particle system always appear at middle of the map (below the floor, since my particle is massive, I saw it in wrong place).
The weird thing is, if I put my particle as root component, then the radial force will only impulse in the middle of the map wherever I spawn this actor.
Here is my code:
AEffectExplosion::AEffectExplosion()
{
ExplodeParticle = CreateDefaultSubobject<UParticleSystemComponent>("My_Particle");
ExplodeParticle->SetupAttachment(RootComponent);
Explosion = CreateDefaultSubobject<URadialForceComponent>("No_Damage_Explosion");
Explosion->SetupAttachment(RootComponent);
Explosion->Radius = 0.f;
Explosion->ImpulseStrength = 0.f;
Explosion->ForceStrength = 0;
//RootComponent = Explosion;
ThisDamage = CreateDefaultSubobject<UDataComponent>("Damage_Only");
ThisDamage->Duration = 1.0f;
InitialLifeSpan = 1.0f;
}
By the way, if I add the component in BP directly, there will be no mistake. I’m really confused.