跳到主要内容

镜头

get_camera

获取摄像机的位置和旋转

  • 参数
  • 返回
    • camera_status(table)
      • position {x,y,z} 摄像机位置
      • rotation {pitch, raw, roll}} 摄像机旋转
      • focus_distance 离观察点距离
local camera_status = game.get_camera()

set_camera

设置摄像机的位置,旋转

  • 参数
    • settings (table)
      • position {x,y,z}/point 摄像机位置
      • rotation {pitch, raw, roll}} 摄像机旋转
      • focus_distance 离观察点距离
      • time 变化时间,设置后朝目标点移动的时间
  • 返回

camera_focus

设置相机跟随单位

  • 参数
    • unit 跟随的单位,为空时取消跟随
local my_hero = player:get_hero()
base.game:camera_focus(my_hero)

get_camera_area

获取摄像机焦点区域,当使用min/max_focus_position时返回的就是min/max_focus_position,使用场景边界时根据场景大小计算

  • 参数
  • 返回 min_x x轴最小值 min_y y轴最小值 max_x x轴最大值 max_y y轴最大值
local x1, y1, x2, y2 = game.get_camera_area()

is_camera_locked

判断摄像机是否是锁定状态

if game.is_camera_locked() then
...
end

lock_camera

锁定摄像机 效果跟服务器的player:lock_camera()一致

if ... then
game.lock_camera()
end

unlock_camera

解锁摄像机 效果跟服务器的player:unlock_camera()一致

if ... then
game.unlock_camera()
end