I want to reset objects which are rotated ,but I can't get the direction when these objects are Loaded.
these objects has been roteted (by rotateX()),i try to get original direction of these(by getOrigin() ),bescause of i didn't use setOrigin() giving these a original direction ,i can't get the direction i needed .
how can i get the direction ?
thanks.
Incidentally , my ultimate goal is Making the world back to the initial state,Namely,back to the state object loaded.
now ,i have reseted the camera in world.
You can save the rotation matrix by object.getRotationMatrix() and reset by object.setRotationMatrix(saved_matrix).
Yes, as fireside suggests, save the rotation matrix. One thing I would add is that you might need to clone the rotation matrix to save it (depending on what jPCT does behind the scenes, I don't know if this is necessary):
Matrix savedMatrix = object.getRotationMatrix().cloneMatrix();
And then to reset, do the same:
object.setRotationMatrix( savedMatrix.cloneMatrix() );
Egon, is this necessary, or does jPCT automatically clone the matrix in these methods rather than using the actual instance passed to them?
Also, it's necessary to set the scale to 1 before using that function and resetting the scale after rotation, so you need getScale to do that. It's in the function def.
Quote from: paulscode on May 07, 2009, 01:36:47 PM
Egon, is this necessary, or does jPCT automatically clone the matrix in these methods rather than using the actual instance passed to them?
Yes, it is. The methods work with the direct references...yes , it's bug prone that way, but when calling these methods very often, it's too slow otherwise.