按住ATL键,鼠标移到"Scene"面板中(这时鼠标变成眼睛形状),拖动鼠标,可以移动场景中的视角,注意:一定要将视角移动成如图所示的X轴在右方,Z轴在前方,Y轴在上方。这步很关键,移成这样的方位,后面移动物体时,前后左右才会正常,不然你的方向可能会和别人相反。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
private Transform m_Transform;
void Start () {
m_Transform = gameObject.GetComponent<Transform>();
}
// Update is called once per frame
void Update () {
MoveControl();
}
void MoveControl()
{
if (Input.GetKey(KeyCode.W))
{
m_Transform.Translate(Vector3.forward * 0.1f, Space.Self);
}
if (Input.GetKey(KeyCode.S))
{
m_Transform.Translate(Vector3.back * 0.1f, Space.Self);
}
if (Input.GetKey(KeyCode.A))
{