轨道摄像机
简介
这项技术能让您将摄像机旋转范围限制在玩家、实体或坐标点周围的轨道上,且轨道高度和半径均可自由调整。
视频演示
指令
BP/functions/camera/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
二维可视化效果:

指令解析:
as @p- 将执行目标设为最近的玩家
at @s- 将执行位置设为目标玩家自身
anchored eyes- 将执行位置提升至目标玩家的眼部高度
rotated ~ 0- 根据目标玩家水平旋转设置执行朝向,但将垂直旋转锁定为0°(平视)
- 若需锁定水平旋转,可改为:
rotated 0 ~- 注:数值
0可更改为所需朝向。详见旋转参数
- 注:数值
- 若不需锁定垂直旋转,直接省略此部分即可实现全向球面旋转。但这样无法避免摄像机穿入地下
positioned ^^1^-2- 将执行位置设定在玩家上方1格、后方2格处
- 调整数值1可增减轨道高度
- 调整数值-2可增减轨道半径
- 负值会使摄像机位于玩家后方
- 正值会使摄像机位于玩家前方
- 更多说明参见:相对坐标系
run camera @s set minecraft:free ease 0.1 linear pos ~~~facing @s- 将摄像机视角方向对准目标玩家自身
类似应用示例:
BP/functions/camera/orbital.mcfunction
yaml
# 围绕带有'wiki:orbital_camera.focus'标签的实体运行轨道摄像机
execute as @p at @e[tag=wiki:orbital_camera.focus] anchored eyes rotated as @s rotated ~ 0 positioned ^^1^-5 run camera @s set minecraft:free ease 0.1 linear pos ~~~ facing @e[tag=wiki:orbital_camera.focus]
BP/functions/camera/orbital.mcfunction
yaml
# 围绕坐标点(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

