MinieExamples/src/main/java/jme3utilities/minie/test/common/AbstractDemo.java
/**
     * Translate a model's center so that the model rests on the X-Z plane, and
     * its center lies on the Y axis.
     *
     * @param cgModel (not null, modified)
     */
Translate a model's center so that the model rests on the X-Z plane, and
its center lies on the Y axis.

@param cgModel (not null, modified)
Translate a model ' s center so that the model rests on the X - Z plane and its center lies on the Y axis . @param cgModel ( not null modified )
public void centerCgm(Spatial cgModel) {
        Validate.nonNull(cgModel, "model");
        Vector3f[] minMax = MySpatial.findMinMaxCoords(cgModel);
        Vector3f min = minMax[0];
        Vector3f max = minMax[1];
        Vector3f center = MyVector3f.midpoint(min, max, null);
        Vector3f offset = new Vector3f(center.x, min.y, center.z);
        Vector3f location = cgModel.getWorldTranslation();
        location.subtractLocal(offset);
        MySpatial.setWorldLocation(cgModel, location);
    }
public void centerCgm ( Spatial cgModel ) { Validate . nonNull ( cgModel , "model" ) ; Vector3f [ ] minMax = MySpatial . findMinMaxCoords ( cgModel ) ; Vector3f min = minMax [ 0 ] ; Vector3f max = minMax [ 1 ] ; Vector3f center = MyVector3f . midpoint ( min , max , null ) ; Vector3f offset = new Vector3f ( center . x , min . y , center . z ) ; Vector3f location = cgModel . getWorldTranslation ( ) ; location . subtractLocal ( offset ) ; MySpatial . setWorldLocation ( cgModel , location ) ; }
Translate a model's center so that the model rests on the X-Z plane, and
 its center lies on the Y axis.
Translate a model ' s center so that the model rests on the X - Z plane and its center lies on the Y axis .