Log in or register to post comments

Change Databases

February 26, 2020 - 12:50am #1

how can i change databases with c # code.

I have a few Model Target databases in the projeckt and I want to change them one after the other.

Thanks

Change Databases

February 27, 2020 - 4:19am #2

Hi,

You can download a repro Unity project that demonstrates untrained Model Target device database swapping, based upon our 8.0 Core samples, here: https://drive.google.com/open?id=1SWM0QB-rZU_Bp1iVl-VUG_cuzsqAPwfe

Disclaimers and caveats:

The additional code, methods and classes, provided as part of this repro project and in addition to what is included as part of the Vuforia Engine Core samples, is done so for instructional use only

The additional code, methods and classes, provided as part of this repro project and in addition to what is included as part of the Vuforia Engine Core samples, should not to be shared outside of your team, organization and/or company

Any sample code provided to you by PTC is done so without warranty. If this code is used in any projects created by you, we take no responsibility for its functionality (or lack thereof)

Instructions for setup:

  1. Unzip ModelTargetDatabaseSwapReproCase.zip
  2. Print Lander.png and Printer.png on A4 paper
  3. Open project in Unity Editor 2018.2.15f1
  4. Drag Assets/SamplesResources/Scenes/3-ModelTargets into the heirarchy
  5. Remove the "Untitled" scene from the heirarchy
  6. At this point, the project is ready to be run in PlayMode and/or on device. For complete functionality, copy LanderMultipleGuideViewCreateTest.[dat|xml] and arPrinter_step1.[dat|xml] to the appropriate folder on your PC (PlayMode) and/or device.



Instructions for use:

  • Start the app
  • Align the printer guide view with the appropriate printout
  • Observed printer detection and augmentation
  • To swap between detecting the printer and lander, tap the lunar lander icon in the lower, right-hand corner when the app is running

Files updated and/or added to the Vuforia Engine 8.0 Core sample's base set of files:

/ModelTargetDatabaseSwapReproCase/Assets/Common/Scripts/MenuOptions.cs

Contains entry-point method HardcodedDatabaseSwap()

/ModelTargetDatabaseSwapReproCase/Assets/Common/Scripts/ModelTargetsDataManager.cs

/ModelTargetDatabaseSwapReproCase/Assets/Common/Scripts/ModelTargetTrackableEventHandler.cs

/ModelTargetDatabaseSwapReproCase/Assets/Common/Scripts/ZipUtil.cs

/ModelTargetDatabaseSwapReproCase/Assets/Common/Scripts/GLTF/GLTFLoader.cs

/ModelTargetDatabaseSwapReproCase/Assets/Common/Scripts/GLTF/JSONParser.cs

/ModelTargetDatabaseSwapReproCase/Assets/Common/Scripts/GLTF/MatrixUtil.cs



I've also done my best to provide additional code comments to help you better understand the steps required. Most importantly, we recommend that you replace our demo augmentation with a custom 3D model for the best user experience.

 

In addition to the above we have https://library.vuforia.com/content/vuforia-library/en/articles/Solution/model-target-test-app-user-guide.html which shows you how to load external db but is meant for Android however this should guide you on how to achieve this.

Also please note that our CoreSample app available on the Unity store features something similar and more important the MT Advanced can store different models in the same database making the process of swapping db not necessary.

Thank you.

Vuforia Engine Support

Log in or register to post comments