math - Matrix transformation - rotate about object origin -
with next code move object along x axis, , rotate relative position every frame.
quad.getmodel().setidentity(); quad.getmodel().scale(new vector3f(10, 10, 10)); quad.getmodel().translate(new vector3f(x, 0, 0)); quad.getmodel().rotate(x * 2, new vector3f(0, 1f, 0f));
now want remove model.setidentity()
. how can accomplish same thing now?
okay, figured out solution self. had rotate every frame, move it, rotate back. reason is, rotation changes object-relative axis. translating moves along new axis. moving along origin, or, "old" axis, needs reset rotation before that.
math matrix 3d
No comments:
Post a Comment