public static Geometry createCube ( Vector3f dimensions , ColorRGBA color ) { checkInit ( ) ; Box b = new Box ( dimensions . getX ( ) , dimensions . getY ( ) , dimensions . getZ ( ) ) ; // create cube shape at the origin Geometry geom = new Geometry ( "Box" , b ) ; // create cube geometry from the shape Material mat = new Material ( assetManager , "Common/MatDefs/Misc/Unshaded.j3md" ) ; // create a simple material mat . setColor ( "Color" , color ) ; // set color of material to blue geom . setMaterial ( mat ) ; // set the cube's material return geom ; }
Creates a cube given its dimensions and its color