Skip to main content
16-Pearl
February 9, 2022
Solved

Model orientation in vuforia studio

  • February 9, 2022
  • 1 reply
  • 2130 views

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?

Best answer by sebben

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)
 }

1 reply

sebben14-AlexandriteAnswer
14-Alexandrite
February 9, 2022

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)
 }
16-Pearl
February 10, 2022

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.

14-Alexandrite
February 10, 2022

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.