unity trigger 获取触发点

时间:2020-04-22 17:46:52   收藏:0   阅读:492

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);

 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!