【问题标题】:How to adjust the amount of rotation programmatically in Roblox first person view?如何在 Roblox 第一人称视图中以编程方式调整旋转量?
【发布时间】:2021-04-09 23:38:03
【问题描述】:

我们的目标是制作一款间谍游戏,以第三人称视角开始,如果玩家按 F 键,则会切换到第一人称视角。第一人称视角,就像配备了双筒望远镜,它有 3 个缩放级别(camera.FieldOfView)。

想象一下,在我面前大约 100 英尺外有一所房子。当我处于第一人称视图时,我想单击键 V 来更改视野。我将有 3 个级别:50 度、30 度和 10 度。

game:GetService("UserInputService").InputBegan:connect(function (input, _)
    if input.KeyCode == Enum.KeyCode.V then
        if player.CameraMode == Enum.CameraMode.LockFirstPerson then
            view_index = view_index + 1
            if view_index >= table.getn(all_views) then
                view_index = view_index - table.getn(all_views)
            end
            camera.FieldOfView = all_views[view_index + 1]
        end
    end
end)

我发现当我移动鼠标时(在鼠标垫上的距离大致相同),我的方向移动大致相同的量,也就是说,它总是在整个房子上移动。如果视野是 30 度,我希望只穿过窗户,如果是 10 度,我希望更少。当我“放大”以查看对象的细节时,我希望对旋转进行更微妙的控制。有没有办法做到这一点?

【问题讨论】:

    标签: lua roblox


    【解决方案1】:

    我是game:GetService("UserInputService")..MouseDeltaSensitivity

    local UserInputService = game:GetService("UserInputService")
    UserInputService.MouseDeltaSensitivity = 0.1 -- or 1, or 0.01 for different sensitivity
    

    查看link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-12
      • 2014-07-09
      • 1970-01-01
      • 2018-04-22
      • 1970-01-01
      • 2018-06-16
      • 1970-01-01
      相关资源
      最近更新 更多