AB4D Forum
Rotation problem - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: Rotation problem (/showthread.php?tid=4461)



Rotation problem - matteocarbonara - 08-02-2024

Hi, 

I wanted to report a problem in the Ab3d samples, in particular in the section "ModelMover and ModelRotator" which refers to the file ModelMoverAndRotatorSample.xaml.cs.
If I initialize the variable "_zAxisAngleRotation3D" with the z axis and an angle of 90 degrees i.e. I apply to the object an initial rotation of 90 degrees around the z axis, then there are some problems with the rotation. For example, if I rotate the object around the x axis, it rotates around another axis different from x.
I think that the problem is in the following line:

"_transform3DGroup.Children.Insert(_transform3DGroup.Children.Count - 2, rotateTransform3D) "

The comment before this line tells "insert before TranslateTransform3D" but in order to insert before TranslateTransform3D I think that the index should be "_transform3DGroup.Children.Count - 1". If I implement this modification, then I have no more problems with the rotation.

Thank you for your time,
Matteo


RE: Rotation problem - abenedik - 08-13-2024

I have fixed the code in the sample based on your information.
Matteo, thank you very much that.