I have a class which derives from actor. In this class I have 2 object - one UStaticMeshComponent and the other is fireBallParticle. I want to disable this actor’s gravity. I have been tried to user SetEnableGravity(false) for both components but it doesn’t work:
AFireBall::AFireBall(const FObjectInitializer& ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = true;
mesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh Component"));
RootComponent = mesh;
fireBallParticle = ObjectInitializer.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("fireBallParticle"));
fireBallParticle->AttachTo(RootComponent);
mesh->SetEnableGravity(false);
fireBallParticle->SetEnableGravity(false);
}
How can I disable the gravity?