How to get World position of LiDAR mesh?

Hi :slight_smile:

So I’m working on a project for which I need to know the positional and rotational values of meshes that are created using the LiDAR scanner and the camera of the device in Unity World coordinates.

I understand that I can utilize ARSessionOrigin to get the position and orientation of trackables in Unity World Space, as the component maps from device / session space to Unity World space.

However, when writing the values of the transform components of the children of ARSessionOrigin.trackableParent to the debug log of Xcode, I can see that only the ARPlanes which ARFoundation detects actually have positional and rotational values. I can see that there are in fact GameObjects names “Mesh XXX” under “Trackables” but the transform values of those objects are 0 (except the scale property which is 1 in every dimension).

Now, is there a way to get the transform of scanned meshes relative to the ARSessionOrigin, i.e. in Unity world space? I want to project some textures onto the mesh and therefore I need both the camera’s position (which is not a problem) and the position of the mesh relative to ARSessionOrigin.

Meshes will always have zero position/rotation if you’re using the ARMeshManager.
But you can get the position of each vertex in a scanned mesh by accessing the Mesh.vertices property.

3 Likes

Thank you, that helped immensely!

1 Like