/** * Creates a transform matrix that will convert from this spatials' local coordinate space to the * world coordinate space based on the world transform. * * @param store Matrix where to store the result, if null, a new one will be created and returned. * @return store if not null, otherwise, a new matrix containing the result. * @see Spatial#getWorldTransform() */ public Matrix4f getLocalToWorldMatrix(Matrix4f store) { if (store == null) { store = new Matrix4f(); } else { store.loadIdentity(); } // multiply with scale first, then rotate, finally translate (cf. // Eberly) store.scale(getWorldScale()); store.multLocal(getWorldRotation()); store.setTranslation(getWorldTranslation()); return store; }