• News

• Industries

• Learning & Support

• Community

• Marketplace

# Incorrect results of simple coordinate transformation with FTransform.

I have a simple example:

``````

FVector TransformTest()
{
FVector translation;
{
translation.X = 0.0f;
translation.Y = 20.0f;
translation.Z = 0.0f;
}

FRotator rotation;
{
rotation.Roll    = 0.0f;
rotation.Pitch  = 0.0f;
rotation.Yaw   = 45.0f;
}

FVector scale;
{
scale.X = 2.0f;
scale.Y = 1.0f;
scale.Z = 1.0f;
}

FTransform test_transform = FTransform(rotation, translation, scale);

return (test_transform.Inverse() * test_transform).GetTranslation();
}

``````

And this function will return vector:

[X = -10.0, Y = -10.0, Z = 0.0].

Expected:

[X = 0.0, Y = 0.0, Z = 0.0].

I am doing transform, for example, LocalToWorld then WorldToLocal, those i start from some space and must return back into this space (with small inaccuracies), but i finish my way in strange space far away from the source.

I have submitted bug to Epic, and got a response:

**Is this behavior correct?

Is it a bug or not?**

What results do you get if you invert A to B inputs on “Compose Transforms” ?

It’s always [0, 0, 0], if u swap them.

If you swap pins on compose, than it will always log correct result.

Yeah that’s expected behaviour. What you’re doing is transforming one transform into the ‘space’ of another. It goes against what you would expect, but it is correct. Mathematical notation is really misleading when it comes to matrices.

I am doing transform, for example, LocalToWorld then WorldToLocal, those i start from some space and must return back into this space
(with small inaccuracies), but i finish my way in a parallel universe.

Is this correct?

It works fine for matrices. But it doesn’t work for FTransform in case of non-uniform scale due to hardcoded order of components application.

So you think this is a bug or not?
And is this behavior correct?