代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html



三五八.冒险视角(按键盘F7键切换30度视角,再按一次返回)

	用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playeractionpicker")的下一行插入以下内容:

TheInput:AddKeyUpHandler(KEY_F7, function()
	if not inst:HasTag("goodangle") then
	   inst:AddTag("goodangle")
	   TheCamera.maxdistpitch = 30
	else
	   inst:RemoveTag("goodangle")
	   if not GetWorld():IsCave() then
		  TheCamera.maxdistpitch = 60
	   else
		  TheCamera.maxdistpitch = 40
	   end
	end
end )

	即可在游戏中按键盘F7键,将游戏视角切换为30度冒险视角(视野更远),再次按F7键返回原本视角