RealDocs

AActor::IsRootComponentMovable

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public

Description

Returns true if the actor's root component has a mobility of EComponentMobility::Movable — the actor can be moved at runtime.

Caveats & Gotchas

  • Returns false when there is no root component. Most gameplay actors (characters, projectiles, vehicles) should have Movable roots; failing to set this correctly can result in missing shadows or missing physics simulation.
  • Does not imply that the actor is currently moving or has a movement component — only that the root component is configured to allow runtime movement.

Signature

ENGINE_API bool IsRootComponentMovable() const;

Return Type

bool

Example

Enable physics only for movable actors C++
if (IsRootComponentMovable())
{
    UPrimitiveComponent* Prim = Cast<UPrimitiveComponent>(GetRootComponent());
    if (Prim)
    {
        Prim->SetSimulatePhysics(true);
    }
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.