Hi
In this example :
http://www.jpct.net/wiki/index.php/Simple_Camera_MovementI don't understand this passage very well :
if (touchTurn != 0) {
SimpleVector backVect = cube.getTransformedCenter();
backVect.scalarMul(-1.0f);
rotationmatrix.translate(backVect);
rotationmatrix.rotateY(touchTurn);
rotationmatrix.translate(cube.getTransformedCenter());
touchTurn = 0;
0- I create a matrix rotationmatrix = new matrix();
1- I create a vector to centerposition of my model
2- I multiply this vector for -1 , why ?
3- I apply the traslation created to my rotationmatrix
4- I rotate it around the Y axis
5- I traslate my matrix to center of my model, why ?
if (touchTurnUp != 0) {
transformMatrix.translate(new SimpleVector(0, -touchTurnUp * 30,0));
touchTurnUp = 0;
}
transformMatrix is a mistake, right ? I have to traslated the rotationmatrix, right ? But why I have to do that ? The rotation round the Y axis is not enough ?
and at last :
transformMatrix.setIdentity();
fb.clear(back);
world.renderScene(fb);
world.draw(fb);
fb.display();
}
I don't understand why I have to do setidentity .
Thanks