# Handheld AR template 4.19. World alignment

**URL:** <https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655>\
**Category:** Blueprint\
**Tags:** UE4-19, template-project, unreal-engine, Augmented-Reality, Blueprint, question\
**Created:** [March 23, 2018, 11:36am UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655 "2018-03-23T11:36:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![plastik21](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plastik21](https://forums.unrealengine.com/u/plastik21)\
**Post date:** [March 23, 2018, 11:36am UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655/1 "2018-03-23T11:36:43Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![plastik21](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plastik21](https://forums.unrealengine.com/u/plastik21)\
**Post date:** [March 25, 2018, 5:17pm UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655/2 "2018-03-25T17:17:28Z")

</div>

Finally, I’ve managed to set world alignment correctly: [[UE 4.19] Testing world alignment in new Handheld AR template project - YouTube](https://youtu.be/LPw-Von1r2g)

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:

 ![234995-arpawn.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/a/2/da2141de4cd17779fd34271f94a7b026b4198139.png)

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?

---

<div class="post-metadata">

**Author:** ![milkman\_penta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@milkman\_penta](https://forums.unrealengine.com/u/milkman_penta)\
**Post date:** [May 13, 2018, 2:37pm UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655/3 "2018-05-13T14:37:53Z")

</div>

figured???

---

<div class="post-metadata">

**Author:** ![plastik21](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plastik21](https://forums.unrealengine.com/u/plastik21)\
**Post date:** [May 13, 2018, 9:48pm UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655/4 "2018-05-13T21:48:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ecdd9af](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ecdd9af](https://forums.unrealengine.com/u/anonymous_user_9ecdd9af)\
**Post date:** [September 25, 2018, 1:06pm UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655/5 "2018-09-25T13:06:36Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![plastik21](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plastik21](https://forums.unrealengine.com/u/plastik21)\
**Post date:** [September 29, 2018, 7:06pm UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655/6 "2018-09-29T19:06:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BreakMaker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/breakmaker/32/971651_2.png) [@BreakMaker](https://forums.unrealengine.com/u/BreakMaker)\
**Post date:** [September 30, 2023, 10:27am UTC](https://forums.unrealengine.com/t/handheld-ar-template-4-19-world-alignment/420655/7 "2023-09-30T10:27:31Z")

</div>

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

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/f/1cf5534299868607a866a2a9042bd34d1eeba353.png)

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).
