Jump to content

Is this a bad idea for bouding boxes?


American2050

Recommended Posts

So, I'm making a block that based on different values, it changes the bounding box.

 

The idea is a block that starts with just a center cube of 6x6x6 and each time it has a neighbour block to conect to on some side it adds a cube to connect to the block next to it.

 

I came with this, but not sure if it's a good idea, or if it should be done in a different way.

 

Pixel is: final static double PIXEL = 1D/16D;

state = state.getActualState(source, pos);
    	
    	double initX = 5*PIXEL;
    	double initY = 5*PIXEL;
    	double initZ = 5*PIXEL;
    	double finalX = 11*PIXEL;
    	double finalY = 11*PIXEL;
    	double finalZ = 11*PIXEL;
    	
    	if (((Boolean)state.getValue(UP)).booleanValue()){
        	finalY = 16*PIXEL;
        }
        if (((Boolean)state.getValue(DOWN)).booleanValue()){
        	initY = 0*PIXEL;
        }
        if (((Boolean)state.getValue(NORTH)).booleanValue()){
        	initZ = 0*PIXEL;
        }
        if (((Boolean)state.getValue(SOUTH)).booleanValue()){
        	finalZ = 16*PIXEL;
        }
        if (((Boolean)state.getValue(EAST)).booleanValue()){
        	finalX = 16*PIXEL;
        }
        if (((Boolean)state.getValue(WEST)).booleanValue()){
        	initX = 0*PIXEL;
        }
    	
    	return new AxisAlignedBB(initX, initY, initZ, finalX, finalY, finalZ);

 

If you need a more graphical representation of what this block looks like let me know.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.