using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ViewControl : MonoBehaviour {
public float speed = 14;
public float mouseSpeed = 60; //定义移动的速度
// Update is called once per frame
void Update () {
float h = Input.GetAxis("Horizontal");//← →
float v = Input.GetAxis("Vertical");//↑ ↓
float mouse = Input.GetAxis("Mouse ScrollWheel");//鼠标滚轮
//调用平移的方法
transform.Translate(new Vector3(h*speed, mouse*mouseSpeed, v*speed) * Time.deltaTime*speed,Space.Self);
}
}
Unity3D初学功能实现——视角平移控制
猜你喜欢
转载自blog.csdn.net/wangjianxin97/article/details/80444925
今日推荐
周排行