Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Das in deine Klasse
- private static final float PI_HALF = (float) (Math.PI / 2);
- private static Vector3f matrixDiffToPHB(Matrix4x4f m1, Matrix4x4f m2){
- Vector3f phb = new Vector3f();
- m1.invert();
- m2.multLeft(m1);
- Tools.matrixToPitchHeadBankPos(m2, phb, null);
- return new Vector3f(-phb.x + PI_HALF, -phb.y, 0);
- }
- //Das dann an die Stelle an der die Rotation ausgelesen werden soll:
- Matrix4x4f mCar = new Matrix4x4f();
- train.getCarMatrix(0, mCar);
- Matrix4x4f mView = new Matrix4x4f();
- sim.getViewMatrix(mView);
- Vector3f phb = matrixDiffToPHB(mView, mCar);
- //phb ist dann eigentlich schon die Rotation die, die kamera beim Abspielen annehmen soll
- //zum Testen (bzw. beim Abspielen dann)
- elm.setRotation(phb);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement