Handheld AR template 4.19. World alignment

Hi all!

I’m experimenting with world alignment feature in new handheld AR template 4.19.
And I can’t figure out what transform should I provide to SetAlignmentTransform node in order to move world origin to other spot. I’ve tried to provide inverse transform of a point (TraceResult) on tracked plane. This works for the first time. But then if click at different location on the same plane, world origin flyes far away. And all the rest clicks move world origin to incorrect spots. The same problem occurs if I provide non-inverse transform.

Also I’ve noticed that GetLocalToTrackingTransform and GetLocalToWorldTransform nodes of a TraceResult object always return identical transforms whatever alignment transform is set.
Is it bug or did I miss something? Where is the tracking space origin located and how it relates to unreal world space?

Any help would be appreciated!

Finally, I’ve managed to set world alignment correctly: [UE 4.19] Testing world alignment in new Handheld AR template project - YouTube

You need to keep current world alignment transform somewhere like in pawn’s variable (it is strange there is no GetAlignmentTransform node). It’s identity by default. When you want to move your world origin to some spot, you must get inverse transform of that spot and compose it with current world alignment transform:

And as I said in the post above GetLocalToTrackingTransform and GetLocalToWorldTransform nodes of a TraceResult object always return identical transforms. I think this is bug. Because why do we need these two identical spaces?

1 Like

figured???

No. I think we will find the right answer when engine developers document AR functionality.

Hello @plastik21
I’ve watched your helicoper AR video on youtube and i wonder how you made these dots? Is it the debug plane or custom mesh plane? I wonder if there is a way to change the default draw debug plane for tracking with some custom mesh.

Also as far i understand the grid plane ( which you move ) is custom mesh with world origin’s coordinates and then you move world origin itself ?

Hi, @MosPetrov. I’ve used simple textured plane mesh to render dots as well as to render grid plane. And you’re right, grid plane is always located at world origin (0,0,0) which is modified by SetAlignmentTransform function.

Now there is a GetAlignmentTransform node, and this is what worked in my case (I do not use the camera’s rotation):

One important thing is that if you change the alignment scale, make sure to feed a scale of [1,1,1] rather than the scale of the alignment transform otherwise your matrix multiplication will be off ( scale gets applied first and then the location when you compose a transform).