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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Mechanism Concept in Vuforia Studio- How to make rotation more easy

RolandRaytchev
21-Topaz I

Mechanism Concept in Vuforia Studio- How to make rotation more easy

Mechanism  Concept in Vuforia Studio- How to make rotation more easy

 

When we try to rotate a model or 3d model item about an axis it seldom rotates about the correct axis as we want. 

So in this case we can help with some mathematical calculation. For example having a door assembly:

2018-06-05_15-38-33.jpg

 

and when we  try to rotate the door model about 60degree it rotates undesired on the wrong axis.

2018-06-05_15-40-50.jpg

 

So the first question is which is this axis and how to change it.

When we have a PVZ model we cannot really change it! 

We can use some mathematical relation to get the correct appearance . In this case the correct javaScript relation should be :

 

...
$scope.simple_door_slider_change = function (angle, door_length) {
 var angle1=angle;
 var l_door=door_length;
 var angle1_rad=angle1*Math.PI/180.0;
$scope.view.wdg['modelItem-door-asm']['rx'] = angle1 ;
$scope.view.wdg['modelItem-door-asm']['y']  = 0.0 - l_door*Math.sin(angle1_rad);
$scope.view.wdg['modelItem-door-asm']['z']  = 0.0 - l_door*(1.0-Math.cos(angle1_rad));
$scope.app.params['door_angle']=  angle1;
};
...

 

So  calling $scope.simple_door_slider_change(70,0.950); will rotate  this particular door assembly on the correct place:

2018-06-05_15-49-57.jpg 

 

But what to do for more complex assemblies. For example when we want to rotate the door handle. Of course the calculation is no problem but this calculation will be more complex (containing movement and rotation )and need some time for the concept of it. The problem is the mostly we do not know what is the correct coordinate axis for each component.

 

Unfortunately, the only option, what we have is to make some consideration already in the Creo Parametric design. So for example the following part have a default coordinate system. Here on the example picture is the name  PRT_CSYS_DEF.

2018-06-05_15-59-21.jpg

When we later rotate about the x  in Vuforia Studio  then it will rotate about the X axis of the default csys here “PRT_CSYS_DEF”

So this means when we have some component which should be later rotated in Vuforia we have to consider it in the design and  need to have the default csys on the correct location. 
2018-06-05_16-03-54.jpg

It is not possible to change it later (there is a workaround where we can use an assembly where we can insert the model. In this case we can move the model inside  the assembly. The assembly will rotate about the default coordinate axis of the assembly

 

So the next step is to think about, how to design a more complex mechanism assembly.

Lets consider the following assembly:2018-06-05_16-14-35.jpg

When we create a project and then try to rotate  different components (arms) via slider then we will have

2018-06-05_16-16-43.jpg

 

So that the one component is rotated as desired but when we rotate the blue component it does not follow  the green component.

The next version of the mechanism we have the correct behavior:

2018-06-05_16-19-25.jpg

 

What is there different?

 

The answer is that we used a different structure. So we nested the moved component in further assemblies.

 

2018-06-05_16-26-02.jpg

It important that in this case the modelItem in vuforia studio we are not using only a parts  but also  assemblies and subassemblies for the definition of modelitems.

 

2018-06-05_16-30-10.jpg

2018-06-05_16-31-59.jpg

 

So in this case we could change the rotation value of the axis and they rotates as desired.  Man Happy

 

2 REPLIES 2

Thank you for the replay!

I agree the post what you mention : https://community.ptc.com/t5/Studio/Is-possible-to-Play-an-Animation-not-a-Sequence-in-TWS-from-Creo/m-p/545977 

is related , but there is  a significant  difference. 

Here in this topic the mean idea is to demonstrate the rules how to design an assembly where a component could be rotated around a particular axis,  where we  simple  change the rotation value of a modelitem (example  "rx" or  "ry").

The idea here is not to perform some kinds of  animations but rather to set in a specific  position an mechanism via setting of values. 

Of course, this also  could  be used  for creating some animation  according  to the post

"How to define a animation engine in javaScript"

Javascript 3D animation engine (I hope is visible from here , if not then ,please, let me know to se...

 

Announcements

Top Tags