# Component have zero world location in inherited Blueprint

**URL:** <https://forums.unrealengine.com/t/component-have-zero-world-location-in-inherited-blueprint/1248302>\
**Category:** C++\
**Tags:** inheritance, unreal-engine, component, CPP, question\
**Created:** [August 2, 2023, 1:27pm UTC](https://forums.unrealengine.com/t/component-have-zero-world-location-in-inherited-blueprint/1248302 "2023-08-02T13:27:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MasterOfDreams](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MasterOfDreams](https://forums.unrealengine.com/u/MasterOfDreams)\
**Post date:** [August 2, 2023, 1:27pm UTC](https://forums.unrealengine.com/t/component-have-zero-world-location-in-inherited-blueprint/1248302/1 "2023-08-02T13:27:13Z")

</div>

Component implemented:

```auto
UPROPERTY(EditAnywhere, BlueprintReadWrite)
	USceneComponent* Spawner;

```

```auto
Spawner = CreateDefaultSubobject<USceneComponent>(TEXT("Spawner"));
	Spawner->SetRelativeLocationAndRotation(FVector::Zero(),FRotator::ZeroRotator,false,nullptr,ETeleportType::None);
	Spawner->Mobility = EComponentMobility::Movable;
	Spawner->bEditableWhenInherited = true;
	Spawner->SetupAttachment(Model);
	Spawner->RegisterComponent();

```

 ![изображение](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/3/f/33f83109e781bb9ae7901dbc83521892575d4e5c.jpeg)

But when I get Spawner Coordinates with c++ from Actor where I implements it, Spwner Coordinates are 0,0,0 in world space, but rotaion works fine.

Idea: I want to make a gun c++ class (RangedWeaponActor), where Spawner is Scene Component. I inherit BP Pistol, Rifle from Gun class and I want to move spawner in local space for each weapon. Then in game spawn projectiles in spawner location and rotation. But location is world zero((((((

---

<div class="post-metadata">

**Author:** ![RafigRzayev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RafigRzayev](https://forums.unrealengine.com/u/RafigRzayev)\
**Post date:** [August 2, 2023, 5:53pm UTC](https://forums.unrealengine.com/t/component-have-zero-world-location-in-inherited-blueprint/1248302/2 "2023-08-02T17:53:44Z")

</div>

I have done the same as you: I have a scene component for a weapon which I can adjust visually in blueprint in order to put it near the tip of weapon.

One idea:  
In my case, I record the adjusted values that are visible in BP, then write them manually in C++, for example:

```
FireOrigin->AddLocalOffset(FVector{78, 0, 0}); // {78,0,0} was acquired in BP

```

Another Idea:  
Change the method with which you get the coordinates.  
There is GetRelativeLocation() and GetComponentLocation() methods. Maybe you can compare their return values.

---

<div class="post-metadata">

**Author:** ![PresumptivePanda](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/presumptivepanda/32/1194593_2.png) [@PresumptivePanda](https://forums.unrealengine.com/u/PresumptivePanda)\
**Post date:** [August 3, 2023, 11:37pm UTC](https://forums.unrealengine.com/t/component-have-zero-world-location-in-inherited-blueprint/1248302/3 "2023-08-03T23:37:51Z")

</div>

Hi there @MasterOfDreams,

Hope you’re well and having a great week so far!

This topic has been moved from **International** to **Programming & Scripting: C++**.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! 🙂
