|
1 | 1 | --- |
2 | 2 | title: Cameras |
3 | | -description: Everything you need to know about Cameras in the Blueprint Format. |
| 3 | +description: Cameras are used to control the player's view during an animation by forcing the player to spectate an animated item_display. |
4 | 4 | --- |
| 5 | + |
| 6 | +# { $frontmatter.title } |
| 7 | + |
| 8 | +{ $frontmatter.description } |
| 9 | + |
| 10 | +## Installing the Camera Plugin |
| 11 | + |
| 12 | +Animated Java does not include camera functionality by default. To add camera functionality to your Data Pack, you will need to install the [Camera Plugin](https://www.blockbench.net/plugins/cameras). |
| 13 | + |
| 14 | +## Creating a Camera |
| 15 | + |
| 16 | +To create a camera, right click the Outliner and select `Add Camera`. |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +If this button isn't there, you can press `h` and then search for `Add Camera`. |
| 21 | + |
| 22 | +## Animating Cameras |
| 23 | + |
| 24 | +Cameras can be animated by adding keyframes to their position / rotation Timelines just like any other element. |
| 25 | + |
| 26 | +## Excuting Commands as / at Cameras Externally. |
| 27 | + |
| 28 | +Sometimes you may want to execute commands at a specific camera's position / rotation from an external function. This can be done by getting the camera's information using the data entity's `data.cameras.<camera_name>` NBT. |
| 29 | + |
| 30 | +:::admonition type=info title=Example |
| 31 | +Teleport the nearest player to the position of a specific camera. |
| 32 | + |
| 33 | +```rust title="foo/as_root.mcfunction" |
| 34 | +execute as <root> on passengers if entity @s[tag=aj.data] run \ |
| 35 | + function foo:position with entity @s data.cameras.<camera_name> |
| 36 | +``` |
| 37 | + |
| 38 | +```rust title="foo/position.mcfunction" |
| 39 | +$execute positioned $(posx) $(posy) $(posz) rotated $(roty) $(rotx) run \ |
| 40 | + tp @p ~ ~ ~ ~ ~ |
| 41 | +``` |
| 42 | + |
| 43 | +::: |
| 44 | + |
| 45 | +:::admonition type=info title=Example |
| 46 | +Force the player to spectate a specific camera. |
| 47 | + |
| 48 | +```rust title="foo/as_root.mcfunction" |
| 49 | +execute as <root> on passengers if entity @s[tag=aj.data] run \ |
| 50 | + function foo:select with entity @s data.cameras.<camera_name> |
| 51 | +``` |
| 52 | + |
| 53 | +```rust title="foo/select.mcfunction" |
| 54 | +$execute as $(uuid) run spectate @s @p |
| 55 | +``` |
| 56 | + |
| 57 | +::: |
0 commit comments