Orbital Camera
Introduction
Sourced By Bedrock Commands Community Discord
This technique allows you to confine your camera rotations to an orbit around the player, an entity, or position, with the height and radius of the orbit being fully adjustable.
Video Demonstration
Command
BP/functions/cameras/orbital.mcfunction
yaml
execute as @p at @s anchored eyes rotated ~ 0 positioned ^^1^-2 run camera @s set minecraft:free ease 0.1 linear pos ~~~ facing @s
2D Visualisation:
Command Breakdown:
as @p
- sets the execution target to closest player.
at @s
- sets the execution position to the target player's self.
anchored eyes
- brings the execution position up to the target player's eye level.
rotated ~ 0
- sets the execution rotation relative to the target player's horizontal rotation but confines the vertical rotation to 0° (straight).
- if you wish to lock the horizontal rotation instead, simply do:
rotated 0 ~
- note: value
0
can be changed to face the direction you need. Refer to Rotations for more info.
- note: value
- if you do not wish to lock the vertical rotation, simply omit this part altogether to get a full spherical rotation. However, this will not prevent the camera from going underground.
positioned ^^1^-2
- pushes the execution position 1 block above the player and 2 blocks behind.
- increase or decrease value 1 to increase / decrease orbit height.
- increase or decrease value -2 to increase / decrease orbit radius.
- Negative value will set the position behind the player.
- Positive value will set the position in front of the player.
- To learn more, refer to: Coordinates System
run camera @s set minecraft:free ease 0.1 linear pos ~~~
- sets the camera for the target player with the
minecraft:free
preset with alinear
ease value of0.1
at relative coordinates (1 block above and 2 blocks behind from the target player's sight) - To adjust camera movement speed increase / decrease ease value
0.1
- To learn about the
/camera
command and it's available options such as presets and ease, refer to the following resources:
- sets the camera for the target player with the
facing @s
- shifts the camera view direction to face the target player's self.
Similar Examples:
BP/functions/cameras/orbital.mcfunction
yaml
# To orbit camera around entity tagged with 'orbit_center'
execute as @p at @e [tag=orbit_center] anchored eyes rotated as @s rotated ~ 0 positioned ^^1^-5 run camera @s set minecraft:free ease 0.1 linear pos ~~~ facing @e [tag=orbit_center]
BP/functions/cameras/orbital.mcfunction
yaml
# To orbit camera around position 6 7 8
execute as @p positioned 6 7 8 rotated as @s rotated ~ 0 positioned ^^1^-5 run camera @s set minecraft:free ease 0.1 linear pos ~~~ facing 6 7 8