Log in or register to post comments

How do I change the properly change a Database in Unity Scene?

February 5, 2020 - 6:47pm #1

Hello,

I am using Unity with Vuforia and would like to click a button or tap on the screen to switch Databases/Model Targets. How can I programmatically do that?

For example, I want to switch from mt1.png to mt2.png (images attached) with a tap on the screen, including switching the Guideview. They are from different databases and have different model targets and guideviews. 

Any help will be greatly appreciated. Thank you!!

AttachmentSize
Image icon mt1.PNG1.84 MB
Image icon mt2.PNG1.72 MB

How do I change the properly change a Database in Unity Scene?

February 6, 2020 - 5:51am #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:

Unzip ModelTargetDatabaseSwapReproCase.zip

Print Lander.png and Printer.png on A4 paper

Open project in Unity Editor 2018.2.15f1

Drag Assets/SamplesResources/Scenes/3-ModelTargets into the heirarchy

Remove the "Untitled" scene from the heirarchy

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, with MT Advanced you can store different models under the same database.

Hope this helps.

Vuforia Engine Support

 

Log in or register to post comments