忽略模型本身之间的碰撞

时间:2017-10-24 15:20:22   收藏:0   阅读:221
using UnityEngine;
using System.Collections;
/// <summary>
/// 忽略模型本身之间的碰撞
/// </summary>
public class IgnoreInternalCollisions : MonoBehaviour {
    void Start () {
    Collider[] colliders = gameObject.GetComponentsInChildren<Collider>();
    for (int i = 0; i < colliders.Length; ++i)
      for (int j = i + 1; j < colliders.Length; ++j)
        Physics.IgnoreCollision(colliders[i], colliders[j]);
    }
}

 

原文:http://www.cnblogs.com/dsh20134584/p/7723669.html

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