分享鼠标手指滑动旋转模型的基本控制脚本

旋转脚本

旋转脚本网上不少,这个也没什么好多说的,解释都在代码里了

本来只是旋转3D模型

改造成,可支持 RenderTexture -> UI,可直接拖动UI

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

/// <summary>
/// 人物展示时的滑动旋转,可旋转模型;据说支持Mobile端操作,待测试;
/// </summary>
public class CharacterRotateController : MonoBehaviour
{
        [Header("点击的区域")]
        [SerializeField] private GameObject target;
        public GameObject touchTargetUI;
        [SerializeField] private float angle = 180f;
        public bool m_IsSwiping = false;
        private Vector3 m_PreviousTouch;

        private RectTransform _rect;

        //貌似 UI是 Overlay模式时不需要传入 camera_ui
        //Camera Cameras_UI;
        // S

猜你喜欢

转载自blog.csdn.net/avi9111/article/details/122567471
今日推荐