如何在Roblox第一人称视角中以编程方式调整旋转量?

目标是制作一款间谍游戏,开始时是第三人称视角,当玩家按下 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 度时则少些。当我“放大”查看物体的细节时,希望对旋转有更细微的控制。有没有办法做到这一点?

点赞
用户10782068
用户10782068

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

local UserInputService = game:GetService("UserInputService")
UserInputService.MouseDeltaSensitivity = 0.1 -- 或者1, 或者0.01以获得不同的灵敏度

查看此链接

2021-01-13 07:02:26