using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseRotateAndMove : MonoBehaviour {
public GameObject gam;
public float speed = 10f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
Event Key = Event.current;
switch(Key.keyCode)
{
case KeyCode.KeypadPlus:
transform.Translate(Vector3.forward * Time.deltaTime * speed);
break;
case KeyCode.KeypadMinus:
transform.Translate(Vector3.forward * Time.deltaTime * -speed);
break;
case KeyCode.LeftArrow:
transform.RotateAround(gam.transform.position,Vector3.up,Time.deltaTime * speed);
break;
case KeyCode.RightArrow:
transform.RotateAround(gam.transform.position, Vector3.u
unity中键盘控制摄像机绕着某个物体旋转
最新推荐文章于 2023-12-10 11:08:58 发布
![](https://img-home.csdnimg.cn/images/20240709112858.png)