[Bug w/repro] Convert Transform to Relative incorrect

Correct me if I’m wrong here.

Convert Transform to Relative should be a node that converts a world transform to a relative transform ( when provided a parent transform ) .

If that’s the case I believe this node is currently errornous. I set up the nodes below so that the node pick up the transform of a ‘picked’ actor and set the transform as relative to the actor. I use a widget to display the transform.

initially it seems correct , but then the picked object is rotated , it is then wrong. Can someone check if this is an intended behavior?

Hello ,

I was able to reproduce this issue on our end. I have written up a report ( UE-22445) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your information and time.

Make it a great day

I ran into this as well, so I did some debugging. There appear to be two problems. KismetMathLibrary.h declares the node as:
static FTransform ConvertTransformToRelative(const FTransform& Transform, const FTransform& ParentTransform);

and states it will give Transform relative to ParentTransform. The code however has the parameters the other way:

FTransform UKismetMathLibrary::ConvertTransformToRelative(const FTransform& WorldTransform, const FTransform& LocalTransform)
{
return LocalTransform.GetRelativeTransformReverse(WorldTransform);
}

So it’s returning the Parent relative to the Transform. Also, it’s using the GetRelativeTransformReverse version. In TransformVectorized.h this is described as:

 * The below 2 functions are the ones to get delta transform and return FTransform format that can be concatenated
 * Inverse itself can't concatenate with VQS format(since VQS always transform from S->Q->T, where inverse happens from T(-1)->Q(-1)->S(-1))
 * So these 2 provides ways to fix this
 * GetRelativeTransform returns this*Other(-1) and parameter is Other(not Other(-1))
 * GetRelativeTransformReverse returns this(-1)*Other, and parameter is Other. 

I’m pretty sure for this node we really want GetRelativeTransform, not GetRelativeTransformReverse. When I fix the parameter swap and the Reverse problem then the node starts returning the right answers. Sadly, my app is still broken, because of the “constructor doesn’t get map specific changes to component values and uses the default blueprint values instead” bug. Sigh.

We did notice the same issue in our team with UE4.11.1.

The suggested fix is trivial and seems to work and solve the issue.
Any news from that ticket?

Hello Julien Guertault,

I went ahead and double checked on this issue for you and it appears that its status has not yet been updated to fixed. However, I will be sure to bump up the community interest for this issue. Thank you for your time and information.

Make it a great day

there is same issue with 4.12.5. i think there is a little bug in function UKismetMathLibrary::ConvertTransformToRelative within KismetMathLibrary.cpp, just swapping ParentTransform and Transform will fix it.

Hello xanatos123,

Thank you for your information. I wanted to update the thread with a link to the public tracker. Please feel free to visit the provided thread for future updates on this issue.

Link: Unreal Engine Issues and Bug Tracker (UE-22445)

Make it a great day

Strange that the variable names were modified but the bug remained. =|

I just spent a week rewriting and retracing a system only to find out that this was the root of my problem. UE-22445 has been open for nearly a year now. This seems to be taking an awfully long time for what should have been a 5-minute fix.

Makes me a little nervous to see what else I’m in for. Seems like a failure of process. Leaving landmines like this in the tools is worse than just cutting the broken functionality entirely.

I’ll bump that thread too, this kind of issue need more attention.

At least I was lucky enough to quickly realize something was fishy. But in a different scenario, I’m I could have lost a of time on it too.

I am pretty disappointed that this is still not fixed…

Any updates on this one? It has been a couple years now and this bites people often.

oh wow. still not fixed?

I don’t know man i’ve been using my own library ever since. sometimes things like that gets irritating because I’ve no idea when it’s fixed.

I’m currently using my own Func library to do this. If anyone wants the code here it is , it’s not 100% optimized, but if anybody wants here’s it.

FTransform UPCMathLibrary::ConvertLocalTransformToWorld(UPARAM(ref) const FTransform & LocalTransform, UPARAM(ref) const FTransform & ParentTransform)
{
FTransform OutTransform;

FVector OutLoc = UKismetMathLibrary::GreaterGreater_VectorRotator(LocalTransform.GetLocation(),(ParentTransform.GetRotation().Rotator())) + ParentTransform.GetLocation();
FRotator OutRot = FRotator(FQuat(LocalTransform.GetRotation()) * FQuat(ParentTransform.GetRotation()));
FVector OutScale = LocalTransform.GetScale3D() * ParentTransform.GetScale3D();

OutTransform.SetLocation(OutLoc);
OutTransform.SetRotation(OutRot.Quaternion());
OutTransform.SetScale3D(OutScale);

return OutTransform;
}

Thanks for the answer! IT’s crazy that UE4 lets bugs like this go so long.

Just a note - line 7 here is incorrect: it should be “FVector OutScale = ParentTransform.GetScale3D() * LocalTransform.GetScale3D();”

This should really be fixed. Had us all scratching our heads for two days and questioning our sanity until we found this thread.

I’m no transform genius, but this seems to do it.

2 Likes

Yah and I just game across it in 4.19… it is just an workaround for people that stumble across this issue.

@Rumbleball this is a bug from 3 years ago referring to the fact that a node does not do the job it’s supposed to do (because it’s inputs are swapped). As far as I know this issue hasn’t been fixed.

how about push it to the UE source?

Still broken, and just wasted a bunch of time tracking down a bug that turned out to be because I was incapable of guessing that the pin inputs were inverted compared to their names and tooltips. (or the output transform is inverted, however you want to put it… )

Ironically someone from my studio already reported this issue… 3 years ago.

I know it might not seem like a hugely high priority fix, but it’d be really appreciated if you could look into it, it causes an outsized amount of frustration, and is a node that simply does not work the way it says on the tin…