unity中按下WASD的时候怎么让摄像机移动
展开全部
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//放到摄像机上 (如果想你让摄像机跟随物体移动的话)再说
public class TestScr : MonoBehaviour
{
void Update()
{
float hor = Input.GetAxis("Horizontal");
float ver = Input.GetAxis("Vertical");
transform.position += new Vector3(hor, ver, 0 );
}
}
using System.Collections.Generic;
using UnityEngine;
//放到摄像机上 (如果想你让摄像机跟随物体移动的话)再说
public class TestScr : MonoBehaviour
{
void Update()
{
float hor = Input.GetAxis("Horizontal");
float ver = Input.GetAxis("Vertical");
transform.position += new Vector3(hor, ver, 0 );
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询