Skip to main content
16-Pearl
August 16, 2023
Question

Vuforia Studio Javascript

  • August 16, 2023
  • 2 replies
  • 1481 views

Hi,

 

I want to trigger an event after completion of each step in Vuforia Studio.

Can someone help me with the same.

 

Thanks in advance.

 

2 replies

16-Pearl
August 16, 2023

with the use Switch case in javascript we can acheive this

14-Alexandrite
August 16, 2023

Hi,

the 'playstopped' event of a model widget is triggered automatically after each step of a sequence.

You can use it to do something in your experience.

 

 

16-Pearl
August 17, 2023

Hi @sebben 

 

I am using the below code it is still not working. Correct me if there is any mistake in the code. Also I wanted to ask the commented out code below is it the right way to call a function which is already defined? 

 

Thanks in advance.

 

$scope.$on('playstopped', function(evt, arg) { 
 
if($scope.view.wdg['modelMaintenance'].currentStep == 3){
      $scope.view.wdg['ping1'].visible = true;
    //$scope.pressPing(1);
      //$scope.showPing(2);
    }
  
  else if($scope.view.wdg['modelMaintenance'].currentStep == 5){
      $scope.view.wdg['ping2'].visible = true;
    //$scope.pressPing(2);
      //$scope.showPing(3);
    }
14-Alexandrite
August 17, 2023

This should work, assuming that your widgets are named the same. (Make sure you change the studio ID not only the friendly name)

You can check the console of the browser in preview and see if there are any errors.

If you can share the project, I could also take a look.

 

The way you call the functions is also correct.