コード例 #1
0
ファイル: PhysX.cs プロジェクト: LOG123/Aurora-Sim-PhysX
        private void ChildRemove (AuroraPhysXPrim odePrim)
        {
            // Okay, we have a delinked child.. destroy all body and remake
            if (odePrim != this && !childrenPrim.Contains (odePrim))
                return;

            DestroyBody ();

            if (odePrim == this)
            {
                AuroraPhysXPrim newroot = null;
                lock (childrenPrim)
                {
                    if (childrenPrim.Count > 0)
                    {
                        newroot = childrenPrim[0];
                        childrenPrim.RemoveAt (0);
                        foreach (AuroraPhysXPrim prm in childrenPrim)
                        {
                            newroot.childrenPrim.Add (prm);
                        }
                        childrenPrim.Clear ();
                    }
                    if (newroot != null)
                    {
                        newroot.childPrim = false;
                        newroot._parent = null;
                        newroot.MakeBody ();
                    }
                }
                return;
            }
            else
            {
                lock (childrenPrim)
                {
                    childrenPrim.Remove (odePrim);
                    odePrim.childPrim = false;
                    odePrim._parent = null;
                }
            }

            MakeBody ();
        }
コード例 #2
0
ファイル: PhysX.cs プロジェクト: LOG123/Aurora-Sim-PhysX
        // I'm the parent
        // prim is the child
        public void ParentPrim (AuroraPhysXPrim prim)
        {
            //Console.WriteLine("ParentPrim  " + m_primName);
            if (this.m_localID != prim.m_localID)
            {
                lock (childrenPrim)
                {
                    foreach (AuroraPhysXPrim prm in prim.childrenPrim)
                    {
                        if (!childrenPrim.Contains (prm)) // must allow full reconstruction
                            childrenPrim.Add (prm);
                    }
                    if (!childrenPrim.Contains (prim)) // must allow full reconstruction
                        childrenPrim.Add (prim);
                }
                //Remove old children
                prim.childrenPrim.Clear ();
                prim.childPrim = true;
                prim._parent = this;

                if (prim.Body != IntPtr.Zero && prim.Body != Body)
                {
                    prim.DestroyBody (); // don't loose bodies around
                    prim.Body = IntPtr.Zero;
                }
                if (m_isphysical)
                    MakeBody (); // full nasty reconstruction
            }
        }
コード例 #3
0
ファイル: PhysX.cs プロジェクト: LOG123/Aurora-Sim-PhysX
 private void ChildSetGeom (AuroraPhysXPrim odePrim)
 {
     DestroyBody ();
     MakeBody ();
 }
コード例 #4
0
ファイル: PhysX.cs プロジェクト: LOG123/Aurora-Sim-PhysX
        private void changelink (AuroraPhysXPrim newparent)
        {
            // If the newly set parent is not null
            // create link
            if (_parent == null && newparent != null)
            {
                newparent.ParentPrim (this);
            }
            // If the newly set parent is null
            // destroy link
            else if (_parent != null && newparent == null)
            {
                //Console.WriteLine("  changelink B");

                if (_parent is AuroraPhysXPrim)
                {
                    AuroraPhysXPrim obj = (AuroraPhysXPrim)_parent;
                    obj.ChildDelink (this);
                    childPrim = false;
                    //_parent = null;
                }
            }

            _parent = newparent;
        }