Issue category: Real-time Mapping-Depth/ ARDK Virtual Studio Tools
Host machine & OS version: Mac 12.0.1
Issue Environment : Unity Mock
Unity version: 2019.4.32f1 Personal
Description of the issue:
Is it possible to mock the ARMesh generation so that this can be played in the IDE instead of on device?
Watched the YouTube video on meshing, and it shows it working on device. Indeed I can get it working on device fine, but I’d like to be able to work with a mesh in the IDE Play mode where it recognizes surfaces I put in the ARDK_MockWorld layer (say a generated terrain).
Is that possible, or is the idea here that I should just render a mock mesh using the same prefabs as assigned to the ARMesh object in the scene?
I built the Mesh Saver app and was able to get some .bin files created.
However although following the instructions in the linked Advanced Tutorial, I get a file system permission error when the MockMeshes script runs, despite no permission problems that I can tell from the OS level. This is on OS X. Obviously Unity has access to the file system and all the project folders, is there something special about access during the Play mode that needs to be added for this script to access the project assets?
$ ls -ld /Users/dav/code/UnityProjects/HotMesh/Assets/MockMeshes
drwxr-xr-x 8 dav staff 256 Dec 17 11:16 /Users/dav/code/UnityProjects/HotMesh/Assets/MockMeshes/
$ ls -l /Users/dav/code/UnityProjects/HotMesh/Assets/MockMeshes
total 3056
-rw-r--r-- 1 dav staff 466268 Dec 17 10:14 mesh_182.bin
-rw-r--r-- 1 dav staff 155 Dec 17 10:28 mesh_182.bin.meta
-rw-r--r-- 1 dav staff 441416 Dec 17 10:14 mesh_197.bin
-rw-r--r-- 1 dav staff 155 Dec 17 10:28 mesh_197.bin.meta
-rw-r--r-- 1 dav staff 641720 Dec 17 10:14 mesh_294.bin
-rw-r--r-- 1 dav staff 155 Dec 17 10:28 mesh_294.bin.meta
The error comes from File.Open(_path, FileMode.Open) in Assets/ARDK/AR/Mesh/_FileARMeshData.cs:
OK. I figured out what was going on here. I think the documentation can be improved to add some clarity.
TLDR: The sentence
Then copy/paste the mesh files to a folder in the scene’s file hierarchy. Right click on the file in the Project window, select Copy Path , and then paste that path into the MockMesh component’s Mesh Path field in the inspector.
should be changed to read:
Then copy/paste the mesh files to a folder in the scene’s file hierarchy. Right click on one of the .bin files in the Project window, select Copy Path , and then paste that path into the MockMesh component’s Mesh Path field in the inspector.
Here’s how this was unclear: the MeshSaver app is designed to create many .bin files, and that makes sense as on the real device the detected/generated mesh is updating continually. It made sense to me that the MockMesh script would mimic that experience and cycle through the .bin files in the folder, so it was expecting the path to the containing folder, not one of the .bin files. I had presumed that the numbers used in the generated .bin files was an indication of at what point in time the mock mesh should update to that mesh after startup.
Other potential improvements to add clarity here, in order of probable effectiveness:
Have the code check that the path points to a File and not a Directory, with a clear error if it is not
Have the code check for the .bin extension, with a clear error if it is missing
Rename the Mesh Path property to Mesh bin File Path