首页 > 编程语言 > 详细

unity trigger 获取触发点

时间:2020-04-22 17:46:52      阅读:492      评论:0      收藏:0      [点我收藏+]

2D

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.GetComponent<AttackBox>())
        {
            hitPos = other.bounds.ClosestPoint(transform.position);
            print("碰撞点" + hisPos);
        }
    }

 

3D

other.gameObject.GetComponent<Collider>().ClosestPointOnBounds(transform.position);

 

unity trigger 获取触发点

原文:https://www.cnblogs.com/sanyejun/p/12753488.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!