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

Level 12

## 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:

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

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;
\$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:

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.

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.

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:

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

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:

What is there different?

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

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.

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

2 REPLIES 2
Highlighted

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

Hi

Please refer to the following link, it maybe helpful for you

https://community.ptc.com/t5/Studio/Is-possible-to-Play-an-Animation-not-a-Sequence-in-TWS-from-Creo...

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

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...

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

Surveys are coming to the Vuforia Community!  Your feedback is valuable to us!  When prompted, please take our 60 second survey!

Top Tags