Skip to main content
15-Moonstone
April 27, 2022
Solved

Hide/show 3D Image after clicking on 3D model

  • April 27, 2022
  • 2 replies
  • 1665 views

Hello developers,

I was trying to implement simple on/off process of 3D image. With using 2D button I am able to on/off the 3d images but my project requires me to use 3D model as button. Is this possible? 

 

Looking for some sample code to help me understand the process.

 

Regards,

 

Best answer by sgreywilson

The JavaScript below can be used to toggle the visibility of an image.

Add toggleImage  to the click event on the model and pass the studio id for example toggleImage("myImage");

 

console.log($scope.app) ;

$scope.toggleImage = function (myImage) {
      $scope.view.wdg[myImage].visible = !$scope.view.wdg[myImage].visible;
}

2 replies

21-Topaz I
April 27, 2022

Hi @ppandarkar-2_183531 ,

yes you can handle the click on a 3D model via the userpick event. The following links are related -

1.)How can we make a 3D Widget on HoloLens visible in front of me everytime ?

2.) How to create a custom button pressable on HoloLens device?

Ok the described techniques is more advanced -and the example are for the HoloLens  but you see the usage in 2.) of the userpick - this should work also for mobile devices

16-Pearl
April 29, 2022

The JavaScript below can be used to toggle the visibility of an image.

Add toggleImage  to the click event on the model and pass the studio id for example toggleImage("myImage");

 

console.log($scope.app) ;

$scope.toggleImage = function (myImage) {
      $scope.view.wdg[myImage].visible = !$scope.view.wdg[myImage].visible;
}