BoundingBox - MrsDarth/Skirt GitHub Wiki

Bounding Box

A bounding box is a 3d cuboid between 2 points. Bounding Box points are in Vectors instead of Locations, this is because Bounding boxes do not have a world. How to turn a vector into a location will be explained down in Vectors As Locations

Getting a new Bounding Box

To get a Bounding Box, you can use these expressions

(bounding|hit)[ ]box of %entities%
(bounding|hit)[ ]box of %blocks%
[new ]bounding box (from|between) %vector% (and|to) %vector%
[new ]bounding box with centre %vector% with dimensions [x ]%number%, [y ]%number%, [z ]%number%

From the first two expressions, you can get the bounding box from entities or blocks.

Blocks

The bounding box of a block usually returns the collision shape for blocks, can vary depending on the block eg. signs, slabs, trapdoors. Sometimes is not accurate for blocks such as water/lava, which returns a blank bounding box with all components 0. And stairs just as a regular 1x1x1 block as bounding boxes cannot have irregular shapes.

Entities

The bounding box of an entity just returns its "hitbox" shape.

From Vectors

The last 2 expressions use vectors as inputs.

The first creates a bounding box between on 2 provided points as vectors. Which you can easily get from locations using skript's vector from location expression

Lastly, you can create a bounding box from a centre position with xyz dimensions. eg. bounding box with centre vector(0,0,0) with dimensions 1, 2, 3 will return a bounding box between vector 1, 2, 3 and vector -1, -2, -3

Bounding Box Blocks

You can get the blocks within bounding boxes using the expression:

blocks within [[bounding] box] %boundingboxes%[ in %world%]

A useful example of this expression would be combining it with an entity's bounding box to get the blocks the entity is touching.

Conditions

Here are some conditions you can use with bounding boxes:

[[bounding ]box ]%boundingbox% (fully contain[s]|intersects[ with]) %boundingbox%
[[bounding ]box ]%boundingbox% does(n't| not) (fully contain[s]|intersects[ with]) %boundingbox%
[[bounding ]box ]%boundingbox% (contain|does not contain)[s] %vectors%

The first 2 allow you to check whether a bounding box intersects, (at least partly inside of) or fully contains another bounding box. And the last checks if a bounding box contains the specified points.

Vectors As Locations

You can get a location from a vector using:

%vectors% as location[s][ in %world%]

Requires a world input, otherwise will just default to event-world as locations need to have a world.

Visualising Bounding Boxes

A useful debug/testing tool you can use to visualise bounding boxes with particles so that you can see them in work is:

[vector] box outline of %boundingboxes%[ with density %number%]

This returns a list of vectors in the shape of the bounding box.

Example usage:

command blockshape:
  trigger:

    set {_box} to bounding box of (exact target block)
    set {_vectors::*} to box outline of {_box} with density 5
    set {_locations::*} to {_vectors::*} as locations

    loop 10 times:
      play happy villager at {_locations::*}
      wait 2 ticks

What this does is show an outline of a bounding box using particles when the command /blockshape is run. You could also make a function to visualise bounding boxes to use for testing.

More

There are a few more things that this addon has to offer with bounding boxes which you can find here