首页 > 代码库 > 鼠标控制模型旋转

鼠标控制模型旋转

using UnityEngine;
using System.Collections;
public class RotaRole : MonoBehaviour
{
    public Vector3 mousePos;
    IEnumerator onm ouseDown()
    {
        mousePos = Input.mousePosition;
        while (Input.GetMouseButton(0))
        {
            Vector3 offset = mousePos - Input.mousePosition;
            transform.Rotate(Vector3.up * offset.x, Space.World);
            //transform.Rotate(Vector3.right * offset.y, Space.World);
            mousePos = Input.mousePosition;
            yield return null;
        }
    }
}

鼠标控制模型旋转