Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi, i have issue on rotate model.
I binding a slider value to model rx.
but model rotate is confuse.
how do I rotate the model in place?
thanks.
Warm Regards,
SeonHo
Solved! Go to Solution.
Hi @CHASEONHO ,
unfortunately, in your case you have a model coordinate system which is with large shift to the center of gravity of this model where you intuitively will expect the rotation.
We need to pay attention that models will be rotated always about his mode coordinate system ( For example if the model is coming form Creo Parametric it will rotated about Model default coordinate system)
There are 2 possible way to fix the issue.
Here for example we have a door component where the default Z axis is not on the desired position where we want to rotate the door. In this case we can use the following code (below) to rotate about he correct axis (door hinge):
//////////////////////// $scope.simple_door_slider_change = function () { var angle1= $scope.view.wdg['slider-1']['value']; var l_door=0.999; 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; };
This above is one particular example for the general rotation case you can check in web. Key word are something like "coordinates transformations" or "transformation matrix for coordinates systems". There should be a lot of information available
Hi @CHASEONHO ,
unfortunately, in your case you have a model coordinate system which is with large shift to the center of gravity of this model where you intuitively will expect the rotation.
We need to pay attention that models will be rotated always about his mode coordinate system ( For example if the model is coming form Creo Parametric it will rotated about Model default coordinate system)
There are 2 possible way to fix the issue.
Here for example we have a door component where the default Z axis is not on the desired position where we want to rotate the door. In this case we can use the following code (below) to rotate about he correct axis (door hinge):
//////////////////////// $scope.simple_door_slider_change = function () { var angle1= $scope.view.wdg['slider-1']['value']; var l_door=0.999; 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; };
This above is one particular example for the general rotation case you can check in web. Key word are something like "coordinates transformations" or "transformation matrix for coordinates systems". There should be a lot of information available