Skip to main content
10-Marble
May 10, 2021
Solved

How to change model when 3D button is clicked

  • May 10, 2021
  • 1 reply
  • 2857 views

Hello Everyone.

Sorry if this question was asked already.
I'm new to Vuforia Studio and am just trying to create contents using the tutorials and guides available here.

I am now tasked to create a content using HoloLens and I was given a model to work with.
My task is to create a button that when clicked (or when I tap at the specific part), it will change the model to another one.

I have a 4 part component.
What I want is when I click on a button (or tap the part), the model will change to an exploded version.
I have here a pvz file that all components are compact.
Another pvz file where part 1 is exploded, another one where part 2 is exploded, so on, until part 4.
So basically I have 5 pvz files.

Is this possible?
I'm sorry, I'm so new about this and I don't have any background or training. Hope you can help me..
Or if you could link a useful resource, I would really appreciate it.

Thank you.

Best answer by Jimwang

@Adrian_G. ,

For 3D Eyewear experiences, you can use 3D Button to set the source of the model dynamically. The logic is:

 

1> Define an application parameter, like "modelSelect"

2> Upload the Models to the resources

3> Create a JS script like below to set the source of the "model-1" widget based on the value of "modelSelect". Call the function for the click of the 3D button:

/////////////////////////////////////////////////////////////////////////////

$scope.changeModel = function (modelSelect) {
let models = $scope.view.wdg['model-1'];
switch (modelSelect)
{
case 1:
models.src='app/resources/Uploaded/blue_pump.pvz';
break;
case 2:
models.src='app/resources/Uploaded/Fan.pvz';
break;
default:
models.src='app/resources/Uploaded/Robot Arm Model.pvz';

}
}

//////////////////

 

 

1 reply

16-Pearl
May 11, 2021
Adrian_G.10-MarbleAuthor
10-Marble
May 11, 2021

Hello Sir

Thank you for the reply.
Yes, I managed to do that. But I don't know how will I make it using HoloLens.

When creating an experience for Tablet or Mobile devices, I am using that step.
Now I am trying to do the same for 3D Wear devices and I don't know how to do it not using Select Widget.

Or I am just missing something?


Adrian_G.10-MarbleAuthor
10-Marble
May 11, 2021

Additional Information:

I tried to make this experience using Mobile Environment.. 
I used a 2D Widget (Select) and I can switch models dynamically.

But using 3D Wear as an environment, it is quite difficult.
There is no 2D widgets and I really don't know what to do next.

I badly need help. 😞