首页 > 其他分享 >常用代码

常用代码

时间:2023-02-03 11:24:56浏览次数:38  
标签:mousePos 常用 Collider 10 代码 最简

物体拖拽最简实现

using UnityEngine;

[RequireComponent(typeof(Collider))]
public class CardTouch : MonoBehaviour
{
    private void onm ouseDrag() {
        var mousePos = Input.mousePosition;
        mousePos.z = 10; // select distance = 10 units from the camera
        transform.position = Camera.main.ScreenToWorldPoint(mousePos);
    }
}

 

标签:mousePos,常用,Collider,10,代码,最简
From: https://www.cnblogs.com/sanyejun/p/17088510.html

相关文章