3DObject.rotateMesh() does not reset the exsisting rotation.

Started by Dan MacDonald, December 15, 2004, 11:42:51 AM

Previous topic - Next topic

Dan MacDonald

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

EgonOlsen

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.

Dan MacDonald

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)