minecraft.wiki-mirror/wiki_backup/bounding box.txt
2024-12-24 06:17:34 -05:00

226 lines
18 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[[File:Zombie chasing villager with hitboxes.png|thumb|right|A [[zombie]] chasing a [[villager]] with their hitboxes visible by using {{Keys|F3 + B}} debug hotkey.]]
A '''hitbox''' defines the physical "boundaries" (or an approximation thereof) of a [[block]] or [[entity]]. Hitboxes are utilised in the calculations of collisions and targeting.
Unlike with block models, all hitboxes' sizes are hard-coded and cannot be changed independently without modification. However, it can be scaled via {{Cd|minecraft:scale}} [[attribute]].
Entities' hitboxes are color-coded, and can be seen through the {{Keys|F3 + B}} [[debug hotkey]].
== Entity hitboxes ==
=== Bounding box ===
[[File:Entities' hitboxes comparison.png|thumb|right|Entities have different sizes of bounding box next to each other. From the left to right, the shortest to tallest: chicken, pig, cow, [[creeper]], [[zombie]], and [[enderman]].]]
The bounding box manages an entity's collision with other entities and blocks. It is also used for detecting hits and interactions from players, [[villager]]s, [[arrow]]s, and other entities.
The bounding box is shown as a white color-coded hitbox around the entities.{{only|java}} It moves with the entity but maintains a static orientation without rotating.
An entity's bounding box can transform into different shapes depending on the situation. For instance, a pufferfish when approached by players gradually expands its shape, from unpuffed, to semi-puffed, then to fully puffed. It instantly shrinks its shape back to normal once it cools down. Players can also change their bounding box by [[sneaking]], crawling, swimming, [[gliding]], or any other means.
=== Eye height ===
[[File:Wither skeleton and villager eye height.png|thumb|right|A [[wither skeleton]] has a taller eye height hitbox (red) than a [[villager]], making it suffocate in the barrier block above it.|alt=]]
The eye height shows an entity's eyes placement. It is used for detecting when an entity is submerged in a water or phasing through a solid block. In this state, the game usually times the entity running [[Damage#Drowning|out of air]] or [[suffocate]].
The eye height is also used to determine if two [[entities]] can see and follow each other by their eye contact.<ref name="eye-contact">{{mcnet|how-crawling-came-minecraft|How crawling came to Minecraft|July 21, 2020|Henrik Kniberg}}</ref>
The eye height is shown as flat red lines typically appearing on entities' eyes or head.
A long blue tint placed in-line with the eye height hitbox shows which direction entities are looking.
=== Passenger attachment point ===
The passenger attachment point shows the point where an entity passenger is attached on a [[Transportation|mountable entity]].
The passenger attachment point is shown as a small green hitbox. This hitbox appears on a mountable entity when it is [[Riding|mounted]] by another entity.
When an entity mounts another entity, the passenger's bounding box aligns precisely with the bottom side of the passenger attachment point hitbox.
== Block hitboxes ==
=== Collision box ===
[[File:Fences_hitboxes_height.png|thumb|[[Fence]]s have a one [[blocks tall]] interaction box, but with 1.5 blocks tall collision box.]]
The collision box manages block collision with entities. The collision boxes for blocks are usually shaped in cubes, but some may have different shapes, like [[slab]]s, [[lectern]]s, [[fence]]s, [[wall]]s, and [[stair]]s.
A collision box may not be present for all blocks, like [[non-solid block]]s such as [[grass]], [[sign]], [[button]], [[lever]] and [[torch]] have no collision box. Some blocks may have custom collision box that make them semi-solid, like [[scaffolding]] and [[hanging sign]].
While most blocks have their collision box identical to their interaction box, some may have different collision box compared to their interaction box counterpart. For instances, the [[lectern]]s' collision box do not extend into the upper part of their interaction box, and the [[fence]]s' collision box are a bit taller than their interaction box.
=== Interaction box ===
[[File:Barrier_Outline_Box_(held).png|thumb|200px|A [[barrier]] block's interaction box is shown when hovered by the [[crosshair]].]]
The interaction box manages block interactions with entities, such as block placement, destruction, right-click, and other interactions. The interaction box is shown in black outlines around the block's edges when looking at the given block; this is especially visible in the [[barrier]] block.
The interaction boxes for blocks are usually contained within its own 1×1×1 cube space, but some blocks are capable of extending outside of this space.<ref name="outline-bug">{{bug|MC-158827}}</ref> There are several instances where this can be seen:
*The arm of an extended [[piston]] &ndash; specifically the part that protrudes into the piston's block space.<ref name="outline-bug"/><ref>{{bug|MC-124459}}</ref>
* The extended top of an opened [[shulker box]].<ref name="outline-bug"/>
* The very top part of a [[lectern]]'s head.<ref name="outline-bug"/> This is especially obvious when a block is placed above the lectern, making lectern's outline overlap with the block.
This behavior is caused by the ray-casting that usually detect the interaction box precense to never collide with it, even though it should.<ref name="outline-bug"/>
== Miscellaneous hitboxes ==
[[File:Campfire's smoke particles colliding with barrier block.png|thumb|right|160px|Smoke particles coming from the [[soul campfire]] colliding with the barrier block, but not the glass block.]]
=== Third-person view camera collision box ===
The [[third-person view]] camera has a collision box that collides with solid blocks, but doesn't collide with transparent blocks, such as [[glass]]es and glass panes, and non-solid blocks. However, the third-person view camera does collide with the [[barrier]] block.
=== Smoke particles collision box ===
Smoke particles have a collision box that collides with solid blocks. Smoke particles come from the [[campfire]], and have collision unlike other [[particles]], which usually phase through blocks and entities. Likewise, smoke particles do not collide with transparent blocks and non-solid blocks, but collide with the barrier block.
== List of entities' hitboxes ==
Most [[entities]]' bounding boxes are shaped in {{w|cuboid}}s, and do not always overlap with the [[model]]s of the entities. For example, the [[witch]]'s bounding box does not include the upper part of its hat, and the [[wither]]'s bounding box does not include the two heads on its sides. Because most bounding boxes are cuboids, it is standard to measure them by their '''width''' and '''height''', with both being measured in [[blocks tall]].
Not all entities have a single cuboid bounding box, some entities like the [[ender dragon]] have multiple distinct hitboxes. The list mainly shows the sizes of an entity's bounding box or similar, other hitboxes may be include in the notes.
The list is mainly exclusive to {{el|java}}, unless stated otherwise.
{{msgbox
|title=Table Legend
|type=notice
|mini=1
|text=Here are information about the indicators that are used in the table:
* '''Varies''' indicates that entity has variable hitbox sizes.
* '''None''' indicates that entity does not have hitbox sizes.
* '''N/A''' indicates that no data is available for the hitbox sizes.
* Empty cell indicates that entity may not have hitbox sizes or no data is available. (None or N/A)
Hitbox data are sourced either from in-game or the entities wiki articles.
}}
{{/Entities' hitboxes}}
==== Ender dragon ====
The [[ender dragon]] has nine distinct hitboxes, consisting of a single massive white hitbox with eight small green hitboxes inside. These green hitboxes move as the ender dragon flies, but do not rotate. Players can damage the ender dragon by hitting one of their green hitboxes.
=== Variable hitbox sizes ===
The size of an entity's hitbox is not necessarily static and may change depending on certain situations. For instance, a player's hitbox gets smaller while crouching, and a pufferfish's hitbox changes while its puffing. Entity may also spawn in different sizes, like [[slime]] and [[magma cube]].
Below is the list of entities whose hitbox can change sizes given specific situations, note this only list a few entities and its not complete. <!-- TODO: [[Hitbox/Entities' hitboxes]] lists all of them, someone can copy and reorganize the data into this table -->
{| class="wikitable sortable collapsible"
! Entity !! States !! Height !! Width
|-
| rowspan="2" | {{EntityLink|Enderman}}
| Normal || 2.9 || 0.6
|-
| Angry || 3.25 || 0.6
|-
| rowspan="4" | {{EntityLink|Player}}
| Normal || 1.8 || 0.6
|-
| Sneaking || 1.5 || 0.6
|-
| Gliding/swimming || 0.6 || 0.6
|-
| Sleeping || 0.2 || 0.2
|-
| rowspan="3" | {{EntityLink|Pufferfish}}
| Unpuffed || 0.35 || 0.35
|-
| Semi-puffed || 0.49 || 0.49
|-
| Fully Puffed || 0.7 || 0.7
|-
| rowspan="3" | {{EntityLink|Shulker}}
| Closed || 1 || 1
|-
| Peeking || 1.2 || 1
|-
| Open || 2 || 1
|}
== History ==
=== Block hitboxes ===
{{cleanup|section=1|all information on the list need to be placed on the history table}}
*The hitboxes of [[pointed dripstone]] in [[Java Edition 20w48a]] could sometimes also randomly extend into adjacent blocks, allowing this to be seen.<ref>{{bug|MC-206643|||Fixed}}</ref> Fixed in [[Java Edition 20w49a]].
*The hitboxes of [[melon stem]]s and [[pumpkin stem]]s with ages 8{{verify}} and over could visually extend into the block space above them while they existed (from Beta 1.8 Pre-release up to [[Removed blocks|the removal]] of the last four in 14w10a and the remaining four in 14w25a).
*The hitboxes of [[cake]]s with 8{{verify}} or more bites could extend into the adjacent block space while these existed (from Beta 1.2 up to their removal in 14w26a).
*The hitboxes of cakes and [[cacti]] [[Java Edition distance effects|at far distances]] could previously (from Beta 1.2 and Alpha v1.0.11 respectively up to their fixing, although it became unobservable for cake from 15w38a onward due to {{bug|MC-106300|||Fixed}}) also become greater than a full block, allowing this to be seen.
==== Collision box ====
{{info needed section|
* {{bug|MC-1635}}
* {{bug|MC-73302}}
* {{bug|MC-1720}}
* b1.9pre2: did the wireframe also change?}}
{{HistoryTable
|{{HistoryLine|java}}
|{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 2|[[Fence]]s no longer have a full block hitbox on the xz plane, and instead more closely match their shape.}}
|{{HistoryLine||1.1|dev=12w01a|The [[fence gate]] hitbox has changed to match the changes made to fence hitboxes.}}
|{{HistoryLine||1.4.4|dev=1.4.3|[[Wall]]s now have their own collision box size - previously they shared their size with fences.<ref>{{bug|MC-1332|||Fixed}}</ref>
|The above change also fixed [[Java Edition distance effects#Fences, fence gates and walls|a bug causing their hitboxes to distort and stop working correctly at far distances from the world origin]].}}
|{{HistoryLine||1.5|dev=13w06a|Fence hitboxes have been changed - concave corners now have their collision boxes respect that rather than always using its effective convex hull, resulting in an invisible portion of collision box there.
|The above change also fixed [[Java Edition distance effects#Fences, fence gates and walls|a bug causing their hitboxes to distort and stop working correctly at far distances from the world origin]].}}
|{{HistoryLine||1.13|dev=17w47a|The hitbox of [[brewing stand]]s now takes into account the central rod as well.<ref>{{bug|MC-4504|||Fixed}}</ref>{{verify|is this actually an entity collision thing?}}
|The collision box of [[wall]]s has been made to be correctly concave.<ref>{{bug|MC-2666|||Fixed}}</ref>{{verify|is this also an entity collision thing?}}}}
|{{HistoryLine||1.14|dev=19w13a|The outline boxes of [[cauldron]]s now fit the model better, allowing for blocks beneath it to be targeted.<ref>{{bug|MC-129205|||Fixed}}</ref>{{verify|is this actually an entity collision thing?}}}}
}}
==== Interaction box ====
{{HistoryTable
|{{HistoryLine|java pre-classic}}
|{{HistoryLine||rd-132211|Targeted blocks now have a visual indicator in which they alternate between bright and dark continuously.}}
|{{HistoryLine|java classic}}
|{{HistoryLine||0.0.13a|Targeted blocks also have a thin outline box.}}
|{{HistoryLine||0.24_SURVIVAL_TEST|The holographic pulsating hitbox displayed when able to place or break a block has been removed, leaving just the wireframe hitbox.}}
|{{HistoryLine||?|The hitboxes for some blocks (flowers, mushrooms, torches) are no longer full cubes, and are more fitting for the size of the block.}}
|{{HistoryLine|java infdev}}
|{{HistoryLine||Minecraft Infdev|dev=20100313|link=Minecraft Infdev|slink=Java Edition Infdev 20100313|Prior to this version, the wireframe hitbox for highlighting blocks would behave increasingly incorrectly [[Java Edition distance effects#History|at far distances from the world origin]]. On all supported hardware, its position would jitter erratically with small shifts in camera rotation. On some GPUs/graphics cards, the geometry of the box would also distort, resulting in non-cubic shapes.}}
|{{HistoryLine|java alpha}}
|{{HistoryLine||v1.0.11|The hitbox of cacti at far distances became greater than a full block.}}
|{{HistoryLine|java beta}}
|{{HistoryLine||1.2|The hitbox of cakes at far distances became greater than a full block.}}
|{{HistoryLine|java}}
|{{HistoryLine||?|[[Stairs]] cannot be targeted at angles where the crosshair does not point at a solid feature of the block. However, the wireframe outline still displays as a full cube regardless.}}
|{{HistoryLine||?|The hitboxes for randomly misaligned blocks such as tall grass are now themselves randomly offset as well to accommodate them.}}
|{{HistoryLine||1.9|dev=15w38a|[[Cake]]'s wireframe hitbox now always appears at (0,0,0) regardless of where the targeted cake actually is. This also masks a distance issue fixed in 15w49a - see below.}}
|{{HistoryLine|||dev=15w46a|The hitbox of [[redstone wire]] now covers only part of the surface of the [[block]] below, based on the orientation of the redstone.}}
|{{HistoryLine|||dev=15w49a|Prior to this snapshot, the wireframe hitboxes used for cake and cactus would appear stretched and misshapen [[Java Edition distance effects#History|at far distances from spawn]].}}
|{{HistoryLine|||dev=15w49b|The hitbox height of the [[end portal block]] has been increased from {{frac|1|16}} of a block to {{frac|3|4}} of a block.}}
|{{HistoryLine||1.11|dev=16w35a|Cake's hitbox now appears at the right position again.<ref>{{bug|MC-106300|||Fixed}}</ref>}}
|{{HistoryLine||1.13|dev=17w47a|The outline boxes of [[anvil]]s and [[hopper]]s now much more closely fit the model shape of these blocks.
|The hitbox of [[brewing stand]]s now takes into account the central rod as well.<ref>{{bug|MC-4504|||Fixed}}</ref>{{verify|is this actually an entity collision thing?}}
|The outline boxes of [[fence]]s is now correctly L-shaped, T-shaped or +-shaped when branching in perpendicular directions.<ref>{{bug|MC-12000|||Fixed}}</ref>
|[[Cactus]] now has a correct cuboid outline box.<ref>{{bug|MC-59610|||Fixed}}</ref>
|Blocks containing multiple [[vines]] now have better outline boxes.
|[[Glass pane]]s and [[iron bars]] have cleaner outline boxes when branching.
|[[End portal frame]] outline boxes now properly account for the eye.
|[[Piston]] and [[lily pad]] outline boxes were changed.
|The collision box of [[wall]]s has been made to be correctly concave.<ref>{{bug|MC-2666|||Fixed}}</ref>{{verify|is this actually an entity collision thing?}}}}
|{{HistoryLine||1.14|dev=18w48a|The outline boxes of [[bed]]s now match better the visual shape of the bed.}}
|{{HistoryLine|||dev=19w13a|The outline boxes of [[cauldron]]s now fit the model better, allowing for blocks beneath it to be targeted.<ref>{{bug|MC-129205|||Fixed}}</ref>}}
|{{HistoryLine||1.16|dev=20w10a|[[Fire]] now has an outline box (alongside [[soul fire]]),<ref>{{bug|MC-163655|||Fixed}}</ref> bringing it more in line with other blocks. Previously, fire had no outline box at all, and breaking it required targeting underlying blocks, which also allowed it to be put out in [[Creative mode]] when holding a [[sword]] or [[trident]], which were programmed to not break blocks. It also prevented its block states from being read in the [[debug screen]] or modified via [[debug stick]].}}
|{{HistoryLine|||dev=20w18a|The outline box of [[redstone wire]] has been changed to much more closely the visual shape of the block. For example, redstone wire branching in different directions causes its outline box to itself branch in said directions,<ref>{{bug|MC-137336|||Fixed}}</ref> mirroring the behavior of fences, glass panes, iron bars and walls, and, if traveling up the side of a block, the vertical portion of the dust can now also be targeted.<ref>{{bug|MC-153508|||Fixed}}</ref>}}
|{{HistoryLine||1.17|dev=20w49a|The overall width of the outline box of the [[pointed dripstone]] is reduced by {{frac|1|8}} of a block.}}
}}
=== Entity hitboxes ===
{{HistoryTable
|{{HistoryLine|java}}
|{{HistoryLine||1.4.4|dev=1.4.3|{{key|F3}} + {{key|B}} now shows the hitbox around [[entities]]. At this point, the hitbox is white and opaque and does not have an outline.}}
|{{HistoryLine||1.7.2|dev=1.7.1|Debug entity hitboxes have visually changed to be more intuitive.}}
|{{HistoryLine||1.20.2|dev=23w31a|{{key|F3}}+{{key|B}} now shows the passenger's attachment point on the entity it's riding.}}
}}
== Issues ==
{{issue list|hitbox}}
== Gallery ==
=== Screenshots ===
<gallery>
Ender dragon green hitboxes.png|[[Ender dragon]] has nine distinct hitboxes.
Wither hitbox.png|Wither heads don't have a hitbox of its own.
Player hitbox while gliding using elytra.png|[[Player]]s' small hitbox while [[gliding]] using an elytra.
Sheep upside down hitbox.png|Sheep has the same hitboxes despite being [[Name_Tag#Easter_eggs|upside down]].
Items having entity hitboxes.png|Netherite, diamond, and emerald have entity hitboxes.
Item frames and painting having entity hitboxes.png|Pseudo-blocks like item frame and painting have entity hitboxes.
</gallery>
== References ==
{{reflist}}
== Navigation ==
{{Navbox gameplay}}
[[de:Hitbox]]
[[es:Caja de colisión]]
[[ja:当たり判定]]
[[pt:Caixa de colisão]]
[[ru:Хитбокс]]
[[zh:判定箱]]