unity 通过鼠标旋转物体

using UnityEngine;
using System.Collections;

public class RoatMove : MonoBehaviour {
public GameObject o;
public GameObject r;

float a;
float aa;
bool b;
bool bb;
Vector3 weizhi;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButtonDown(0))
    {
        //按下鼠标左键  将鼠标位置赋值给weizhi  方便后面进行对比
        weizhi = Input.mousePosition;
    }

    if (Input.GetMouseButton(0))
    {
        if (weizhi.x>Input.mousePosition.x)//如果位置的x轴大于现在鼠标的x轴,说明鼠标再往左移动
        {
            a = -1f;
            b = true;
            weizhi = Input.mousePosition;//将现在鼠标的·1值赋值给weizhi
        }
        else if (weizhi.xInput.mousePosition.y)
        {
            aa = -1;
            bb = true;
            weizhi = Input.mousePosition;
        }
        else if (weizhi.y

}

你可能感兴趣的:(unity)