simmania
(simmania)
February 19, 2015, 4:14pm
1
Components only have:
SetRelativeLocation()
SetRelativeRotation()
and:
GetRelativeTransform().GetLocation()
GetRelativeTransform().GetRotation().Rotor()
However the GetRelativeTransform().GetLocation() does not return relative-to-parent location/translation!
MickD777
(MickD777)
February 19, 2015, 5:21pm
2
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?
simmania
(simmania)
February 19, 2015, 9:18pm
3
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.
MickD777
(MickD777)
February 19, 2015, 10:36pm
4
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!
simmania
(simmania)
February 20, 2015, 11:06am
5
Maybe I have tested this wrong, ill look into it.
You ever find a result for this?