cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Model orientation in vuforia studio

Aditya1702
15-Moonstone

Model orientation in vuforia studio

Hi,

After the sequence is played in Vuforia Studio I want to change the orientation of the model in the middle of step 2 of the sequence so that the dismantling of a particular part is seen & again I want to change the orientation in the middle of step 3 of the sequence. How do I go about this in Vuforia Studio?

ACCEPTED SOLUTION

Accepted Solutions
sebben
14-Alexandrite
(To:Aditya1702)

Hi,

In AR it is usually better to direct the user around the model so they can see what is happening from the right direction.

If that is not possible in your case it would be easier to turn the model in Creo Illustrate.

If that is also not possible you can do animate the turning of the part also for example like this:

 

var modelname = "model-2"; //change according your model
$scope.$on('playstarted', function(evt, arg) {
  if($scope.view.wdg[modelname].currentStep == 2){
    $scope.movePart(modelname,"ry",4,180);
  }
  if($scope.view.wdg[modelname].currentStep == 3){
    $timeout(function(){
      $scope.movePart(modelname,"ry",-4,-180);
    }
             , 1500);// adjust time in ms to start in the middle of the step
  }
}
          );
$scope.movePart= function(partName, d, val, distance){
  var start = $scope.view.wdg[partName][d];
  var inter =  $interval(function() {
    $scope.view.wdg[partName][d] += val;
    if(val>0){
      if( $scope.view.wdg[partName][d]>=start+distance)
      {
        $interval.cancel(inter);
      }
    }
    else{
      if( $scope.view.wdg[partName][d]<=start+distance)
      {
        $interval.cancel(inter);
      }
    }
  }
                         ,50)
  }

View solution in original post

4 REPLIES 4
sebben
14-Alexandrite
(To:Aditya1702)

Hi,

In AR it is usually better to direct the user around the model so they can see what is happening from the right direction.

If that is not possible in your case it would be easier to turn the model in Creo Illustrate.

If that is also not possible you can do animate the turning of the part also for example like this:

 

var modelname = "model-2"; //change according your model
$scope.$on('playstarted', function(evt, arg) {
  if($scope.view.wdg[modelname].currentStep == 2){
    $scope.movePart(modelname,"ry",4,180);
  }
  if($scope.view.wdg[modelname].currentStep == 3){
    $timeout(function(){
      $scope.movePart(modelname,"ry",-4,-180);
    }
             , 1500);// adjust time in ms to start in the middle of the step
  }
}
          );
$scope.movePart= function(partName, d, val, distance){
  var start = $scope.view.wdg[partName][d];
  var inter =  $interval(function() {
    $scope.view.wdg[partName][d] += val;
    if(val>0){
      if( $scope.view.wdg[partName][d]>=start+distance)
      {
        $interval.cancel(inter);
      }
    }
    else{
      if( $scope.view.wdg[partName][d]<=start+distance)
      {
        $interval.cancel(inter);
      }
    }
  }
                         ,50)
  }
Aditya1702
15-Moonstone
(To:sebben)

Hi Sebben,

Thanks a lot for your help the solution given by you did worked. I just wanted to know about the parameters inside the code mentioned below:

$scope.movePart(modelname,"ry",-4,-180);

modelname & "ry" I got those, can you please tell me about the other 2 parameters which are : -4 & -180.

 

Thanks once again for your help.

sebben
14-Alexandrite
(To:Aditya1702)

Yes I could have documented that better, sorry. So "val" is the change per step (in this case -4 degrees per step) and distance is the complete change after that the animation stops (in this case after -180 degrees)

You can adjust the animation time by changing the val parameter.

Aditya1702
15-Moonstone
(To:sebben)

Thanks a lot for helping me out.

Announcements

Top Tags