Jump to content

Bounding Box Qs


david476

Recommended Posts

The bounding box works by having a set minimum x, y, and z, and a maximum x, y, and z.

 

The center of the bounding box is between the min x and max x, the min y and the max y, etc.

 

I'm pretty sure it doesn't rotate.

Kain

Link to comment
Share on other sites

bounding boxes can move with blocks but you have to add another method to change the bound box with orientation, the bound box is done in floats i believe it starts to one side of a block, not from the middle, but you can figure out what values change what side by trial and error

 

this is code for a cube like bounding box in the middle of a block

 

this.setBlockBounds(A-0.170F, B-0.0F, C-0.180F, D-0.830F, E-0.80F, F-0.820F);

 

B value when increased moves the bottom of the bounding box upwards the E value when DECREASED moves the top of the bounding box down or when Increased moves the bounding box border upwards

 

i believe A and D are x axis, also C and F are y axis (OR THE OTHER WAY AROUND) off memory the bound box DOESNT move with entities but i may be wrong there may be a way for it

Link to comment
Share on other sites

Hi

 

By center I mean what the mins and maxs measure from. Location of the entity? Also, are these variables pixels or blocks or other(what unit)?

 

The bounding box is "centred" around around the entity location [posX, posY, posZ]. 

It doesn't automatically rotate as the entity rotates, it always stays aligned with the x, y, and z axes.

The units are the same as the blocks, i.e. 1.0 is 1 metre is 1 block.

 

-TGG

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.