RealDocs

AActor::K2_DetachFromActor

function Engine Blueprint Since 4.12
#include "GameFramework/Actor.h"
Access: public Specifiers: UFUNCTIONBlueprintCallable

Description

Detaches this actor's root component from whatever scene component it is currently attached to. The detachment rules control whether the actor retains its relative or world-space transform after detaching.

Caveats & Gotchas

  • The default KeepRelative rule means the actor will jump to the world origin if you forget to switch to KeepWorld — always specify KeepWorld when you want the actor to stay at its current visual position after detaching.
  • If the actor was never attached, this is a no-op; it does not assert or log an error, so call it freely without a prior attachment check.
  • Physics welding side effects (shapes transferred during attachment) are NOT automatically reversed on detach; re-simulate or reconstruct physics state manually if needed.

Signature

ENGINE_API void K2_DetachFromActor(EDetachmentRule LocationRule = EDetachmentRule::KeepRelative, EDetachmentRule RotationRule = EDetachmentRule::KeepRelative, EDetachmentRule ScaleRule = EDetachmentRule::KeepRelative);

Parameters

Name Type Description Default
LocationRule EDetachmentRule Whether to keep the relative or world position after detaching. EDetachmentRule::KeepRelative
RotationRule EDetachmentRule Whether to keep the relative or world rotation after detaching. EDetachmentRule::KeepRelative
ScaleRule EDetachmentRule Whether to keep the relative or world scale after detaching. EDetachmentRule::KeepRelative

Return Type

void

Example

Drop a carried object and keep its world position C++
// Detach and keep the actor at its current world position
CarriedItem->K2_DetachFromActor(
    EDetachmentRule::KeepWorld,
    EDetachmentRule::KeepWorld,
    EDetachmentRule::KeepWorld
);
CarriedItem->GetRootComponent()->SetSimulatePhysics(true);

Version History

Introduced in: 4.12

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.