Hi, I had very limited expirience with 3D, and I don’t have clear understeanding of how calculations have done for that kinda matter, but I’ll try to share what I can.
To store rotation I created an object of Quaternion class, it stores 4 components of orientation in 3d space. Rotation object with position and scale passed to Matrix4 object like this:
public Matrix4 calculateTransform() {
return new Matrix4(position, rotation, scale);
}//end method calculateTransform
and it stored in the ModelInstance object:
public void act(float dt) {
modelData.transform.set(calculateTransform());
}//end method act
and this method is for changing components of rotation object:
public void turn(float degrees) {
rotation.mul(new Quaternion(Vector3.Y, -degrees));
}//end method turn
and this is done in update() method:
if(Gdx.input.isKeyPressed(Keys.Q))
weaponObject.turn(-rotateSpeed * dt);
This is what I’ve done in my Alien Vehicle, actually it is from a book “Lee Stemkoski - Beginning Java Game Development with LibGDX (The Expert’s Voice in Java) - 2015”. I noticed its very popular amongst LibGDX newbies.
I hope it will be helpful, if you need my code I’ll share it somehow