# GetRelativeTransform confusing

**URL:** <https://forums.unrealengine.com/t/getrelativetransform-confusing/307440>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [February 19, 2015, 4:14pm UTC](https://forums.unrealengine.com/t/getrelativetransform-confusing/307440 "2015-02-19T16:14:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![simmania](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@simmania](https://forums.unrealengine.com/u/simmania)\
**Post date:** [February 19, 2015, 4:14pm UTC](https://forums.unrealengine.com/t/getrelativetransform-confusing/307440/1 "2015-02-19T16:14:50Z")

</div>

Components only have:  
SetRelativeLocation()  
SetRelativeRotation()

and:

```
GetRelativeTransform().GetLocation() 
GetRelativeTransform().GetRotation().Rotor()

```

However the GetRelativeTransform().GetLocation() does not return relative-to-parent location/translation!

---

<div class="post-metadata">

**Author:** ![MickD777](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MickD777](https://forums.unrealengine.com/u/MickD777)\
**Post date:** [February 19, 2015, 5:21pm UTC](https://forums.unrealengine.com/t/getrelativetransform-confusing/307440/2 "2015-02-19T17:21:22Z")

</div>

You can use this to get World location.

```
yourComp->GetComponentLocation();
yourComp->GetComponentRotation();

```

the GetRelativeTransform() will indeed give relative location and rotation. Are you sure you are testing that correctly?

---

<div class="post-metadata">

**Author:** ![simmania](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@simmania](https://forums.unrealengine.com/u/simmania)\
**Post date:** [February 19, 2015, 9:18pm UTC](https://forums.unrealengine.com/t/getrelativetransform-confusing/307440/3 "2015-02-19T21:18:56Z")

</div>

No, I want the relative location and rotation. But GetRelativeTransform().GetLocation() does NOT return relative location!  
I changed it for GetRelativeTransform().GetTranslation() and that works as expected.

---

<div class="post-metadata">

**Author:** ![MickD777](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MickD777](https://forums.unrealengine.com/u/MickD777)\
**Post date:** [February 19, 2015, 10:36pm UTC](https://forums.unrealengine.com/t/getrelativetransform-confusing/307440/4 "2015-02-19T22:36:35Z")

</div>

Yes it does. You must be using it wrong or, for some reason, you have encountered a bug. On what engine version are you?

As a proof that it works, I did it right here with an actor that has a static mesh component with a 100.0f offset. Here is the code and result.

```
	FVector relativeLoc = myComp->GetRelativeTransform().GetLocation();
	FVector worldLoc = myComp->GetComponentLocation();

	UE_LOG(Main, Log, TEXT("relativeLoc %.2f %.2f %.2f"), relativeLoc.X, relativeLoc.Y, relativeLoc.Z);
	UE_LOG(Main, Log, TEXT("worldLoc %.2f %.2f %.2f"), worldLoc.X, worldLoc.Y, worldLoc.Z);

```

Output:  
Main: relativeLoc 0.00 0.00 100.00  
Main: worldLoc 5250.42 16316.65 -1171.26

If it is indeed a bug, it would be nice to know how you can reproduce it too!

---

<div class="post-metadata">

**Author:** ![simmania](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@simmania](https://forums.unrealengine.com/u/simmania)\
**Post date:** [February 20, 2015, 11:06am UTC](https://forums.unrealengine.com/t/getrelativetransform-confusing/307440/5 "2015-02-20T11:06:32Z")

</div>

Maybe I have tested this wrong, ill look into it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a46415501](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a46415501](https://forums.unrealengine.com/u/anonymous_user_a46415501)\
**Post date:** [August 1, 2019, 1:28pm UTC](https://forums.unrealengine.com/t/getrelativetransform-confusing/307440/6 "2019-08-01T13:28:37Z")

</div>

You ever find a result for this?
