纳金网

标题: 第一视角角色设置详细步骤 [打印本页]

作者: 晃晃    时间: 2011-11-20 21:07
标题: 第一视角角色设置详细步骤


           比较具体的一个小教程,对初学者比较用用!
           

           Follow step by step guide below to convert your 3rd Person Shooter Demo from UnityTechnologies to First Person Shooter.
         

            
         



            Move your Camera Near Player's arm and Attach it to Human game object. In my case x is -0.56, y is 1.38 and z is 0.025.
         


            Edit your Shooter Game Camera script as below.
         


           
         


            Edit your Normal Character FPS Script. Remove UpdateFacingDirection() function because the MouseLook script will take place for that. Also remove moveRotationSpeed variable and call to UpdateFacingDirection() function. Your script now looks like this.
         

           
         


           
         


           
         


            Attach MouseLook script to camera and Human game object. Change Axes for camera to  Mouse Y and for Human to Mouse X. You must have standard assets Character Controller package imported into project to have MouseLook script.
         

           
         


           
         


            Change MouseLook script Update() function to LateUpdate() so the movements of the camera will follows work fluid with ShooterGameCamera script.
         


            Chane HeadLookController's Responsiveness variables to 10 so it is better suited for First Person Shooter.
         


            Now we have to fix the problem of camera when we die it is destroyed and our death looks unrealistic. Edit the RagdollInstantiater Script as below.
         


           
         


           
         


            Now we almost complete our setup. Create new camera call it DeathCamera and assign it to RagdollInstantiater Script of Human GameObject. Change DeatCamera's x rotation to 90 so it sees player's head and disable the game object for now.
         


           
         


            Enjoy your new First Person Shooter. Make sure you credit RBSoft and UnityTechnologies if you use this in your game. Modified scripts can be downloaded frombelow.
         

          本文转自:http://rbsoft.weebly.com/2/post/2011/09/unity-3d-first-person-character-setup.html
         


作者: 菜刀吻电线    时间: 2012-2-8 23:25
真是不错啊

作者: 菜刀吻电线    时间: 2012-2-19 23:26
不会吧,太恐怖了

作者: 菜刀吻电线    时间: 2012-4-3 13:18
赞一个,哈哈

作者: 晃晃    时间: 2012-4-25 23:18
既来之,则看之!

作者: tc    时间: 2012-5-13 23:20
路过、路过、快到鸟,列位请继续...ing

作者: 菜刀吻电线    时间: 2012-5-31 23:19
凡系斑竹滴话要听;凡系朋友滴帖要顶

作者: tc    时间: 2012-7-14 23:22
好`我顶``顶顶

作者: C.R.CAN    时间: 2012-10-21 23:19
顶!学习了!阅!

作者: C.R.CAN    时间: 2012-12-9 23:24
路过、路过、快到鸟,列位请继续...ing

作者: 菜刀吻电线    时间: 2012-12-15 23:20
好铁多多发,感激分享





欢迎光临 纳金网 (http://rs.narkii.com/club/) Powered by Discuz! X2.5