I don't quite get it yet (I will once I see it working), but this is what I wrote. It's a variation on yours in that I get the ship's YAxis, I set look.z, and up became (0, 0, 1) to account for the x/y plane:
private void pauls() {
SimpleVector look = new SimpleVector( ship.getYAxis() );//getZAxis
look.add(ship.getTransformedCenter());
look.z = ship.getTransformedCenter().z;
look.normalize();
SimpleVector up = new SimpleVector(0, 0, 1);
SimpleVector right = up.calcCross( look ).normalize();
Matrix m = new Matrix();
m.set( 0, 0, right.x );
m.set( 1, 0, up.x );
m.set( 2, 0, look.x );
m.set( 3, 0, 0.0f );
m.set( 0, 1, right.y );
m.set( 1, 1, up.y );
m.set( 2, 1, look.y );
m.set( 3, 1, 0.0f );
m.set( 0, 2, right.z );
m.set( 1, 2, up.z );
m.set( 2, 2, look.z );
m.set( 3, 2, 0.0f );
m.set( 0, 3, 0.0f );
m.set( 1, 3, 0.0f );
m.set( 2, 3, 0.0f );
m.set( 3, 3, 1.0f );
if (shipLeveling == 15) {
lastRotation = ship.getRotationMatrix();
shipLeveling = 0;
}
lastRotation.interpolate(lastRotation, m, 0.12f);//OINTERPOLATE BETWEEN THE MATRICES
Matrix matrix = new Matrix(lastRotation);
ship.setRotationMatrix(matrix);
shipLeveling++;
}
Is it supposed to be right? Because it doesn't work yet (the screen goes black, of all things).