So if you have two transforms, let’s say: A and B.
You can get the B transform’s relative location to the transform A by doing B.GetRelativeTransform(A) let’s store the value of that into C. Now C represents B’s location in the local space of A.
So, the problem is: is there any way to reverse the FTransform::GetRelativeTransform in a way that we could get the transform B by knowing only A and C (AKA get the C transform in the world space).
I’m 99% sure there is a way to do it and I probably could write it my self, but it wouldn’t make any sense for the FTransform API to not include it then.
I’m also aware that there is a function FTransform::GetRelativeTransformReferse but that doesn’t seem to be what I’m looking for, in fact I think A.GetRelativeTransform(B) == B.GetRelativeTransformReverse(A);
This could also be one of those cases where I miss something pretty obvious, since I’m pretty tired currently.
I don’t think FTransfrom has anything innately, but AActor::ActorToWorld I think does what you want. Maybe take a look at that function. There’s also one for ComponentToWorld
In the end they all call this function
USceneComponent::UpdateComponentToWorldWIthParent ← Id check there and break it down
Well, there you use the USceneComponent’s API to get it’s world transform, my problem however is how to get the world space transform by only having the two transforms: A in the world space and B that is relative to A.
I find it pretty weird how the function GetWorldTransform does not exist for FTransform (as GetRelativeTransform does).
I Guess one way of achieving my goal would be to construct two scene components, give those the transforms A and B and use the USceneComponent::GetWorldTransform there. Though that would be so wacky that I rather wouldn’t do it that way…
I’ve found for a number of reasons that using SceneComponents to do any kind of hierarchal transformation always ends up benefitting me in the long run.
Especially in cases where you run into dealing with 3+ coordinate spaces all stacked on each other. Sometimes it’s just nice to see it all visually in the editor that way.
It can seem pretty bloated to do it that way I agree, but it’s never been a bottleneck for me personally.
Yeah I believe that could be beneficial in many cases, not just in mine.
I have a component that has an array of relative transforms and they have an application where they must be converted to world space, they can’t be in world space initially however since they are relative to the owning actor of the component.
So the reason I think having a scene component for every transform is not a good idea is the fact that there might be tens of transforms in the array. The unnecessary bloat that would come by having that many components for just one function use is a bit too much in my mind.
This is what I see the best solution in hand, so I’m going to go with it.
Thanks for @KaidoomDev and all of you for helping me.
I still just find it so weird how something like @KaidoomDev 's function isn’t included in the FTransform API. Maybe the people at Epic had a stroke or something while writing it idk XD