您当前的位置: 首页 >  unity

CoderZ1010

暂无认证

  • 2浏览

    0关注

    168博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Unity 使用this关键字进行函数拓展 - Ray

CoderZ1010 发布时间:2021-09-25 11:04:54 ,浏览量:2

Example:

using UnityEngine;
using SK.Framework;

public class Foo : MonoBehaviour
{
    private GameObject target;
    private bool isDetected;

    private void Update()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        //获取射线检测到的物体
        target = ray.GetDetectedObject();
        //获取射线检测到的物体 检测距离为10f
        target = ray.GetDetectedObject(10f);
        //获取射线检测到的物体 检测距离为10f 检测层级为Default层
        target = ray.GetDetectedObject(10f, 1             
关注
打赏
1653184800
查看更多评论
0.2182s