示例#1
0
        public CTransform(CTransform trans)
        {
            this.m_vecPos        = trans.position;
            this.m_quaRot        = trans.rotation;
            this.m_strTag        = trans.tag;
            this.m_strName       = trans.name;
            this.m_vecLocalPos   = trans.localPosition;
            this.m_quaLoaclRot   = trans.localRotation;
            this.m_vecLocalScale = trans.localScale;
            this.m_bActive       = trans.active;

            this.m_cTrans.position = this.m_vecPos;
            this.m_cTrans.rotation = this.m_quaRot;

            this.m_cTrans.localScale = this.m_vecLocalScale;
        }
示例#2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////

        ///////////////////////////////////////////////////// 挂接 API //////////////////////////////////////////

        /// <summary>
        /// 设置子节点
        /// </summary>
        /// <param name="trans"></param>
        public bool Attached(CTransform trans, string boneName)
        {
            if (this.m_cTrans == null)
            {
                return(false);
            }

            foreach (Transform item in this.m_cTrans)
            {
                if (item.name == boneName)
                {
                    trans.m_cTrans.parent = item;
                    trans.localPosition   = Vector3.zero;
                    trans.localRotation   = Quaternion.identity;
                    return(true);
                }
            }
            return(false);
        }
示例#3
0
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 忽略碰撞检测
        /// </summary>
        /// <param name="trans"></param>
        public virtual void IgnorCollider(CTransform trans)
        {
            Collider[] colliders1 = this.m_cTrans.GetComponentsInChildren <Collider>();
            Collider[] colliders2 = trans.m_cTrans.GetComponentsInChildren <Collider>();

            foreach (Collider item1 in colliders1)
            {
                if (item1.isTrigger == true)
                {
                    continue;
                }
                foreach (Collider item2 in colliders2)
                {
                    if (item2.isTrigger == true)
                    {
                        continue;
                    }
                    Physics.IgnoreCollision(item1, item2);
                }
            }
        }