Author Topic: 3DObject.rotateMesh() does not reset the exsisting rotation.  (Read 6667 times)

Offline Dan MacDonald

  • byte
  • *
  • Posts: 9
    • View Profile
3DObject.rotateMesh() does not reset the exsisting rotation.
« on: December 15, 2004, 11:42:51 am »
I'm not sure if this was intentional or not but if you do

my3dObj.rotateY(0.07);
my3dObj.rotateMesh();

in a loop, or repeatedly, you observe what I perceive to be unexpected behavior. What I observed was the calls to rotateY were cumulative, so if i called the rotateY above 10 times, the object would rotate roughly 1 degree after the first call, 2 after the second, 3 degrees after the 3rd and so on.

I expected that rotateMesh() would reset the yRotation value to 0 since it was now permanent, so calling the above two lines of code repeatedly would result in subsequent 1 degree rotations about the Y axis.

I realize that this is not the intended use of rotateMesh, but it may be an issue just the same....

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
3DObject.rotateMesh() does not reset the exsisting rotation.
« Reply #1 on: December 15, 2004, 12:04:46 pm »
No, that's a correct behaviour. By calling rotateMesh(), the actual vertex data will be rotated in object space by the current rotation matrix, i.e. at first, it will be rotated by 0.07, in the second run by 0.14, which results in a combined rotation of 0.21 and so on.
I don't think that you really want to rotate the object in object space in your example, so i suggest to skip that call to rotateMesh() in this case and you should be fine.

Offline Dan MacDonald

  • byte
  • *
  • Posts: 9
    • View Profile
3DObject.rotateMesh() does not reset the exsisting rotation.
« Reply #2 on: December 15, 2004, 12:06:58 pm »
Yes, it works perfectly without the RotateMesh() call, I just wanted to be sure that was the correct behavior. (rotateMesh makes more sense to me now, thanks)