unity中用第三人称视角控制角色移动的方法

 1 using UnityEngine;
 2 using System.Collections;
 3 
 4 public class Player : MonoBehaviour
 5 {   private CharacterController controller;
 6      public int speed=10;
 7 
 8 void Start(){
 9        controller=GetCompoment<CharacterController>();
10 }
11 
12 void Update(){
13 controller.SimpleMove(new Vecter3(Input.GetAxis("Horizontal")*speed,0,Input.Getaxis("Vertical")*speed);
14 }
15 }

 

posted @ 2016-04-15 15:45  礼桀  阅读(1419)  评论(0编辑  收藏  举报