minecraft.wiki-mirror/wiki_backup/view point.txt
2024-12-21 09:59:47 -05:00

60 lines
3.5 KiB
Text

[[File:Perspectives.png|thumb|Perspectives]]
[[File:Temperate Frog (hitbox).png|thumb|A frog's perspective can be seen as a blue line.]]
'''Rotation''' (also known as '''perspective''', '''viewpoint''' or '''viewing angle''') is the direction an [[entity]] is facing. Rotation in ''Minecraft'' consists of '''Y-rotation''' or '''yaw''' and '''X-rotation''', '''declination''' or '''pitch''', each affecting the directions of the body and the head of the entity. For entities without heads, they can sometimes rotate entirely around the X-axis. The "X" and "Y" refers to the axis about which they rotate. Rotation can limit what a [[mob]] or [[player]] can see, but other entities (e.g. [[boats]] and [[item frames]]) also have a rotation.
== Representation ==
{{main|Entity format}}
Rotation is internally represented with two float values in degrees.
* Y-rotation varies from -180° (facing due north) to -90° (facing due east) to 0° (facing due south) to +90° (facing due west) to +180° (facing due north again).
* For X-rotation, horizontal is 0°, with positive values looking downward and negative values looking upward. It does not exceed positive or negative 90°.
== Debug screen ==
{{main|Debug screen}}
With <kbd>F3</kbd> + <kbd>B</kbd>, the rotation of all entities show up as a blue beam.
The player's own rotation can be seen in the [[debug screen]] under ''Facing''. First the cardinal direction and axis are mentioned, followed by the two angles for direction and head tilt.
== Place blocks ==
The viewing angle affects the placement of some blocks: depending on how the player look, for example, a [[banner]] or a [[sign]] rotated accordingly. The viewing angle also plays a role when placing [[stairs]].
== Target selection ==
Target selection properties allow entities to be selected that have a specific viewing angle:
{| class="wikitable"
|y_rotation
|Viewing angle
|-
|x_rotation
|Head tilt angle
|}
Angle ranges are specified with two points, e.g. B. <code>43..47</code>.
/title @a[y_rotation=<view angle>] actionbar {"text":"View direction (compass direction)"}
/title @a[x_rotation=<nowiki><head tilt angle>] actionbar {"text":"head tilt (up)"}</nowiki>
Examples of the cardinal directions:
/execute if entity @p[y_rotation=135..-135] run say North
/execute if entity @p[y_rotation=-135..-45] run say East
/execute if entity @p[y_rotation=-45..45] run say South
/execute if entity @p[y_rotation=45..135] run say West
== Save perspective ==
Blinking angles can be read out and saved in a score: To do this, create a score target for the direction and the inclination.
/scoreboard objectives add direction dummy "viewing angle direction"
/scoreboard objectives add inclination dummy "viewing angle inclination"
Then, read out the direction and inclination using the command <code>/data</code> and save them in the respective score.
/execute as @a store result score @s direction run data get entity @s Rotation[0]
/execute as @a store result score @s tilt run data get entity @s Rotation[1]
== Set perspective ==
The command {{cmd|teleport}} can be used to set the perspective of entities. The entities can move freely after teleportation if they have AI, but they start with the fixed viewing angle.
Additionally, all entities except players can be realigned using the command {{cmd|data}} via the property <code>Rotation</code>
== Viewpoint coordinates ==
{{Main|Coordinates#Relative World Coordinates}}
Circumflexes (<code>^</code>) allow the position to be determined depending on the rotation of an entity.
== History ==
{{Empty section}}
[[de:Blickwinkel]]