代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
1
2三五八.冒险视角(按键盘F7键切换30度视角,再按一次返回)
3
4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playeractionpicker")的下一行插入以下内容:
5
6TheInput:AddKeyUpHandler(KEY_F7, function()
7 if not inst:HasTag("goodangle") then
8 inst:AddTag("goodangle")
9 TheCamera.maxdistpitch = 30
10 else
11 inst:RemoveTag("goodangle")
12 if not GetWorld():IsCave() then
13 TheCamera.maxdistpitch = 60
14 else
15 TheCamera.maxdistpitch = 40
16 end
17 end
18end )
19
20 即可在游戏中按键盘F7键,将游戏视角切换为30度冒险视角(视野更远),再次按F7键返回原本视角