如何在 Roblox 第一人称视角中以编程方式调整旋转量?
How to adjust the amount of rotation programmatically in Roblox first person view?
目标是做一款间谍游戏,开始时是第三人称视角,如果玩家按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 度,我希望只穿过 window,如果是 10 度,我希望越过 window。当我“放大”以查看 object 的细节时,我想对旋转进行更细微的控制。有办法吗?
是game:GetService("UserInputService")..MouseDeltaSensitivity
local UserInputService = game:GetService("UserInputService")
UserInputService.MouseDeltaSensitivity = 0.1 -- or 1, or 0.01 for different sensitivity
勾选这个link
目标是做一款间谍游戏,开始时是第三人称视角,如果玩家按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 度,我希望只穿过 window,如果是 10 度,我希望越过 window。当我“放大”以查看 object 的细节时,我想对旋转进行更细微的控制。有办法吗?
是game:GetService("UserInputService")..MouseDeltaSensitivity
local UserInputService = game:GetService("UserInputService")
UserInputService.MouseDeltaSensitivity = 0.1 -- or 1, or 0.01 for different sensitivity
勾选这个link