Transform/Matrix question

Related to my previous question’s scenario

I have two transform in world space A (Red), B (Blue) and I’d like to compute a relative transform (r) as if B would be the children of A.


// Pseudo code
FTransform r = B - A;

Then later, I’d like find where would B be according to a third transform C (world space)

// Pseudo code
FTransform D = r + C;

Can anyone tell me if is there any builtin math with Matrix/Transform in UE4 or do I need to find my own solution?

The relative transform of B to A is:

Br = B * inv(A)

The world transform of relative transform is:

Bw = Br * A

I might be wrong but…

Bw = Br * A = B * inv(A) * A = B * I = B

Which doesn’t look right, this should do the trick though:

Bw = A * Br

FTransforms are applied left-to-right in my limited UE4 experience.

Bw = Br * A = B * inv(A) * A = B * I = B

That’s exactly how I understood a question. If you didn’t change B or A transforms, than Bw should be equal to initial B.

Ah yes, I fail at reading :slight_smile:

Thank you guys! I did not know that the order in which you apply them changes the result.

This indeed did the tick

Bw = Br * A