Relative to the “rootcomponent” that the “actor” owns. i.e. The root component will be a scene component, or a subclass there of. The “Actor” will own/be a parent of, that root component, it’s the root component that has the base transform, that everything else is based off of. So if you will, say you have 50 static meshes attatched to a “actor”. In truth they are not attached to the actor, they stem from the root component, and their location, etc, is based off there “relative” location (as an example) to the root component. Yes they can have their location etc, set via world coordinates, but that will be translated behindthe scenes, to a local/relative offset to that root component.
Hello. I am new to game development and unreal engine. I am seeing this most places in the engine. RelativeLocation, RelativeRotation, WorldLocation and WorldRotation. I understand the world rotation and location, but what about relative? Relative to what? Can someone explain those to me?
But what if I attach 1 Mesh A to another Mesh B and call get relative transform. Will I get the relative transform to Mesh B and if yes, how can I get the relative transform to the rootcomponent? Do I have to add the transforms manually?
It’s relative to the Parent, NOT the Root.
To show you this, I have created a BP consisting of three components. A cube (root), a sphere and a cone.
Relative transforms. Cone transform relative to its parent (Sphere) and Sphere transform relative to its parent (Cube).
As you see, it gives the relative transform to the parent not to the root (unless parent is the root). One more thing to note is that relative transform for the root component, returns its world transform. Now if you want to find the relative transform of a component to the root, then you should get relative transform of that component and all its parents and sum their transforms (except for the scale, which you should multiply the child’s scale and all of its parents’ scale values) together. Note that this does not apply for rotation. since in rotations, rotators’ order matter.
There is a better way to get a component’s relative translation to the root component or any arbitrary parent on the chain up to the root (specially when the child has so many parents). You can simply subtract the child’s world translation from the root’s world translation or from any other arbitrary parent’s. The result would give the child’s relative translation to that specific parent whether it’s root or not. Note that this method won’t work for scale or rotation.
This is not the correct answer.
I mean… you could also just say “yes” to my answer But yeah, looks like there is no built in functionality to get the transform relative to the root. <3
Actually I wanted to say yes, but I noticed a wrong answer that says its relative to the root, so to make it clear for everyone not to get confused (which answer is correct), I had to answer the question.