Announcement

Collapse
No announcement yet.

Disable actor gravity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Disable actor gravity

    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:

    Code:
    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?

    #2
    I bet you have a Projectile Movement component for your fireball, if so, just set the ProjectileGravityScale to 0.
    If you don't use this component, you should look in GetEffectiveGravityZ() to know how to manage this.

    Comment


      #3
      Well, I do not use this component and GetEffectiveGravityZ belongs to Projectile Movement component: https://docs.unrealengine.com/latest...av-/index.html

      Comment


        #4
        Yes it belongs to it, but you should look how it use to repro the GravityManagement in your movement component.

        Comment

        Working...
        X