Skip to main content
1-Visitor
November 11, 2021
Question

Show/Hide separate models on 3D button clicks for Hololens

  • November 11, 2021
  • 1 reply
  • 1088 views

I'm looking to be able to show a particular model and hide all others on the click of a particular 3D button.  

 

On scene entry, I want a particular model (Model-1) to show and all others to be hidden, which I have done with the following code:

$scope.Test = function() {
  $scope.setWidgetProp('model-2', 'ForceHide', 'true');
};
 $scope.Test();
 $scope.Test = function() {
  $scope.setWidgetProp('model-3', 'ForceHide', 'true');
};
 $scope.Test();
 $scope.Test = function() {
  $scope.setWidgetProp('model-4', 'ForceHide', 'true');
};
 
But then I want to SHOW each model separately when a particular button is pushed.  Then if a user 

1 reply

14-Alexandrite
November 12, 2021

Hi,

 

you just need a function like this:

$scope.UpdateVisibility = function(widget, visibility) {
    $scope.view.wdg[widget].visible = visibility;
}

Then enter in the JS box of the click event for button 1:

UpdateVisibility("model-1", true);
UpdateVisibility("model-2", false);
UpdateVisibility("model-3", false);
UpdateVisibility("model-4", false);

 

For button 2: 

UpdateVisibility("model-1", false);
UpdateVisibility("model-2", true);
UpdateVisibility("model-3", false);
UpdateVisibility("model-4", false);

 

and so on.