private void createRecursively(IBlockNode node, Node sceneNode, int depth, Map<HingeJoint, JointProperties> jointsMap)
	{
		if(depth <= this.maxDepth && numNodes<=tempMaxNodes)
		{
			List<BlockNode> addedChildren = new ArrayList<BlockNode>();
			for(int i=0; i<8; i++)
			{
				boolean ticketToPass = (numNodes==1 && i==7);
				
				if(((r.nextInt(chanceToCreateNode)==0) && numNodes<tempMaxNodes) || ticketToPass)
				{
					boolean collidesWithOtherNodes = true;
					
					Dimensions d = Util.getRandomDimensions();
					JointProperties jp = Util.getRandomJointProps();
					BlockNode newNode= new BlockNode(d, jp, i);
					node.addChild(newNode, i);

					Util.JmeObject jmeObject = Util.createJmeNode(newNode.getDimensions(), app, newNode.getGeometryId()); 
					app.getMaterialsStore().add(jmeObject.material);
					
					Geometry geometry = jmeObject.geometry;
					Spatial parentSpatial = sceneNode.getChild(node.getGeometryId());
					Position p = Position.getPosition(i);
					Position pi = Position.getPosition(Util.getInversePosition(i));
							
					translateGeometry(geometry, parentSpatial, node, newNode, p, pi);
					collidesWithOtherNodes = Util.collidesWithOtherNodes(geometry, sceneNode, node.getGeometryId());
					if(!collidesWithOtherNodes)
					{
						HingeJoint joint = makeJoint(geometry, parentSpatial, node, newNode, jp, p, pi);
						jointsMap.put(joint, jp);
						sceneNode.attachChild(geometry);
						
						numNodes++;
						addedChildren.add(newNode);
						
					}
					else
					{
						node.removeChild(i);
					}
					
				}
				else
				{
					node.getChildren()[i] = null;
				}
			}
			for(BlockNode child: addedChildren)
			{
				createRecursively(child, sceneNode, depth+1, jointsMap);
				depth--;
			}
		}
	}