USceneComponent::GetComponentLocation
#include "Components/SceneComponent.h"
Access: public
Description
Returns the component's world-space location. This reflects the fully resolved transform after applying the parent hierarchy, unlike GetRelativeLocation() which returns only the local offset from the parent.
Signature
FVector GetComponentLocation() const Return Type
FVector Caveats & Gotchas
- • Returns world-space position, not relative to parent. Use GetRelativeLocation() if you need the local offset.
- • The Blueprint-callable version is K2_GetComponentLocation (exposed as 'Get World Location'). In C++ you can call GetComponentLocation() directly for the inline version.
- • For skeletal mesh bone/socket positions, use GetSocketLocation() instead — GetComponentLocation() returns the mesh component's root origin, not individual bone positions.
Example
Get a component's world position C++
FVector MuzzlePos = MuzzleComponent->GetComponentLocation();
SpawnProjectileAt(MuzzlePos, MuzzleComponent->GetComponentRotation()); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?