List of usage examples for com.badlogic.gdx.graphics.g3d ModelInstance calculateTransforms
public void calculateTransforms()
From source file:com.mygdx.game.objects.GameModel.java
License:Apache License
public static void applyTransform(Vector3 location, Vector3 rotation, Vector3 scale, ModelInstance modelInstance) { for (Node node : modelInstance.nodes) { node.scale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z)); }/*from www . j a v a 2 s . c om*/ modelInstance.transform.rotate(Vector3.X, rotation.x); modelInstance.transform.rotate(Vector3.Z, rotation.z); modelInstance.transform.rotate(Vector3.Y, rotation.y); modelInstance.transform.setTranslation(location); modelInstance.calculateTransforms(); }
From source file:ve.ucv.ciens.ccg.nxtar.systems.GeometrySystem.java
License:Apache License
private void applyWorldTransform(ModelInstance model, GeometryComponent geometry) { translationMatrix.setToTranslation(geometry.position); rotationMatrix.val[Matrix4.M00] = geometry.rotation.val[0]; rotationMatrix.val[Matrix4.M10] = geometry.rotation.val[1]; rotationMatrix.val[Matrix4.M20] = geometry.rotation.val[2]; rotationMatrix.val[Matrix4.M30] = 0; rotationMatrix.val[Matrix4.M01] = geometry.rotation.val[3]; rotationMatrix.val[Matrix4.M11] = geometry.rotation.val[4]; rotationMatrix.val[Matrix4.M21] = geometry.rotation.val[5]; rotationMatrix.val[Matrix4.M31] = 0; rotationMatrix.val[Matrix4.M02] = geometry.rotation.val[6]; rotationMatrix.val[Matrix4.M12] = geometry.rotation.val[7]; rotationMatrix.val[Matrix4.M22] = geometry.rotation.val[8]; rotationMatrix.val[Matrix4.M32] = 0; rotationMatrix.val[Matrix4.M03] = 0; rotationMatrix.val[Matrix4.M13] = 0; rotationMatrix.val[Matrix4.M23] = 0; rotationMatrix.val[Matrix4.M33] = 1; scalingMatrix.setToScaling(geometry.scaling); model.transform.idt().mul(translationMatrix).mul(rotationMatrix).mul(scalingMatrix); model.calculateTransforms(); }