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

how to move the model in Z coordinate before it starts playing sequence(animation).

Karthik
7-Bedrock

how to move the model in Z coordinate before it starts playing sequence(animation).

I'm using image target for tracking. I need to move(forward) the model from the image once the tracking is done and before its starts playing sequence(animation). how to do this using Js ?

 

 

1 REPLY 1

Hi @Karthik ,

 

I am not sure if I understood your requirement correctly, but I think you try to following workflow:

- use the tracking aqcuired event for the Image Target to start a function.

another option is to check the istracked property of the image target widget e.g. : app.view['Home'].wdg['imageTarget-1']['istracked']. You can e.g. create a binding to parameter:

 

2020-10-23_10-21-27.jpg

 

and the use $watch construct to check if there is change for the  istracked value:

 

$scope.$watch('app.params.test', function(val) 
              {
//===============================================
  
 if( val==true) //tracked
   {
//play this code first time and set a global variable to 
//ignorre further changes later
   };
  
//===============================================
});

 

Means that you can use such sample event to call a function . Because you can lose the tracking and start it later again - in this case you have to pay attention to start only one time--e.g. when the function is started first time you can set a global variable and  always check when tracking was acquired if the variable was already set.

The started function will move then the model by setting the coordinate.  Here is not clear:

- what should be moved - the whole model (model widget) or only particular component - modelItem. (the principle should be the same but different type of widgets.

- is the direction clear  e.g.  in positive z direction or is it depending on the camera position / the position of your device?

-movement should be continuous movements / speed or it could be a jump - value change only. For speed you can use an interval function.

- it is important that when you move component (modelItem) you need to unset the sequence  property of the model widget because it could block the movement of a particular modelItem. When you move the complete model widget - in this case this is not relevant

- later you can start via javaScript the sequence

Here to the mentioned above the following post could contain a helpful information:

How to write JS to animate sequence step by step

Placeing animations on modelItems with javascript

Link function to a specific step from Illustrate sequence

 

Top Tags