当前位置: 首页>>代码示例>>C#>>正文


C# AuroraODEPrim.DestroyBody方法代码示例

本文整理汇总了C#中Aurora.Physics.AuroraOpenDynamicsEngine.AuroraODEPrim.DestroyBody方法的典型用法代码示例。如果您正苦于以下问题:C# AuroraODEPrim.DestroyBody方法的具体用法?C# AuroraODEPrim.DestroyBody怎么用?C# AuroraODEPrim.DestroyBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aurora.Physics.AuroraOpenDynamicsEngine.AuroraODEPrim的用法示例。


在下文中一共展示了AuroraODEPrim.DestroyBody方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParentPrim

        // I'm the parent
        // prim is the child
        public void ParentPrim(AuroraODEPrim prim)
            {
            //Console.WriteLine("ParentPrim  " + m_primName);
            if (this.m_localID != prim.m_localID)
                {
                lock (childrenPrim)
                    {
                    if (!childrenPrim.Contains(prim)) // must allow full reconstruction
                        childrenPrim.Add(prim);
                    }
                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
                }
            }       
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:24,代码来源:AODEPrim.cs

示例2: RemovePrimThreadLocked

 ///<summary>
 ///  This is called from within simulate but outside the locked portion
 ///  We need to do our own locking here
 ///  Essentially, we need to remove the prim from our space segment, whatever segment it's in.
 ///
 ///  If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory
 ///  that the space was using.
 ///</summary>
 ///<param name = "prim"></param>
 public void RemovePrimThreadLocked(AuroraODEPrim prim)
 {
     //Console.WriteLine("RemovePrimThreadLocked " +  prim.m_primName);
     lock (prim)
     {
         remCollisionEventReporting(prim);
         remActivePrim(prim);
         prim.m_frozen = true;
         if (prim.prim_geom != IntPtr.Zero)
         {
             prim.DestroyBody();
             prim.IsPhysical = false;
             prim.m_targetSpace = IntPtr.Zero;
             try
             {
                 if (prim.prim_geom != IntPtr.Zero)
                 {
                     d.GeomDestroy(prim.prim_geom);
                     prim.prim_geom = IntPtr.Zero;
                 }
                 else
                 {
                     MainConsole.Instance.Warn("[PHYSICS]: Unable to remove prim from physics scene");
                 }
             }
             catch (AccessViolationException)
             {
                 MainConsole.Instance.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed.");
             }
         }
         if (!prim.childPrim)
         {
             lock (prim.childrenPrim)
             {
                 foreach (AuroraODEPrim prm in prim.childrenPrim)
                 {
                     RemovePrimThreadLocked(prm);
                 }
             }
         }
         lock (_prims)
             _prims.Remove(prim);
     }
 }
开发者ID:EnricoNirvana,项目名称:Aurora-Sim,代码行数:53,代码来源:AODEPhysicsScene.cs

示例3: RemovePrimThreadLocked

        /// <summary>
        /// This is called from within simulate but outside the locked portion
        /// We need to do our own locking here
        /// Essentially, we need to remove the prim from our space segment, whatever segment it's in.
        ///
        /// If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory
        /// that the space was using.
        /// </summary>
        /// <param name="prim"></param>
        public void RemovePrimThreadLocked(AuroraODEPrim prim)
        {
            //Console.WriteLine("RemovePrimThreadLocked " +  prim.m_primName);
            lock (prim)
            {
                remCollisionEventReporting(prim);
                remActivePrim(prim);
                lock (ode)
                {
                    prim.m_frozen = true;
                    if (prim.prim_geom != IntPtr.Zero)
                    {
                        prim.DestroyBody();
                        prim.IsPhysical = false;

                        // we don't want to remove the main space

                        // If the geometry is in the targetspace, remove it from the target space
                        //m_log.Warn(prim.m_targetSpace);

                        //if (prim.m_targetSpace != IntPtr.Zero)
                        //{
                        //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom))
                        //{

                        //if (d.GeomIsSpace(prim.m_targetSpace))
                        //{
                        //waitForSpaceUnlock(prim.m_targetSpace);
                        //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
                        prim.m_targetSpace = IntPtr.Zero;
                        //}
                        //else
                        //{
                        // m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
                        //((OdePrim)prim).m_targetSpace.ToString());
                        //}

                        //}
                        //}
                        //m_log.Warn(prim.prim_geom);
                        try
                        {
                            if (prim.prim_geom != IntPtr.Zero)
                            {
                                d.GeomDestroy(prim.prim_geom);
                                prim.prim_geom = IntPtr.Zero;
                            }
                            else
                            {
                                m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene");
                            }
                        }
                        catch (AccessViolationException)
                        {
                            m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed.");
                        }
                        lock (_prims)
                            _prims.Remove(prim);

                        //If there are no more geometries in the sub-space, we don't need it in the main space anymore
                        //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0)
                        //{
                        //if (prim.m_targetSpace != null)
                        //{
                        //if (d.GeomIsSpace(prim.m_targetSpace))
                        //{
                        //waitForSpaceUnlock(prim.m_targetSpace);
                        //d.SpaceRemove(space, prim.m_targetSpace);
                        // free up memory used by the space.
                        //d.SpaceDestroy(prim.m_targetSpace);
                        //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position);
                        //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]);
                        //}
                        //else
                        //{
                        //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
                        //((OdePrim) prim).m_targetSpace.ToString());
                        //}
                        //}
                        //}

                        if (SupportsNINJAJoints)
                        {
                            RemoveAllJointsConnectedToActorThreadLocked(prim);
                        }
                    }
                }
            }
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:98,代码来源:AODEPhysicsScene.cs

示例4: ParentPrim

        // I'm the parent
        // prim is the child
        public void ParentPrim(AuroraODEPrim prim)
        {
            //Console.WriteLine("ParentPrim  " + m_primName);
            if (this.m_localID != prim.m_localID)
            {
                DestroyBody();

                lock (childrenPrim)
                {
                    foreach (AuroraODEPrim prm in prim.childrenPrim.Where(prm => !childrenPrim.Contains(prm)))
                    {
                        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.DestroyBody(); // don't loose bodies around
                    prim.Body = IntPtr.Zero;
                }
                MakeBody(); // full nasty reconstruction
            }
        }
开发者ID:keverw,项目名称:Aurora-Sim,代码行数:32,代码来源:AODEPrim.cs

示例5: RemovePrimThreadLocked

 ///<summary>
 ///  This is called from within simulate but outside the locked portion
 ///  We need to do our own locking here
 ///  Essentially, we need to remove the prim from our space segment, whatever segment it's in.
 ///
 ///  If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory
 ///  that the space was using.
 ///</summary>
 ///<param name = "prim"></param>
 internal void RemovePrimThreadLocked(AuroraODEPrim prim)
 {
     remCollisionEventReporting(prim);
     remActivePrim(prim);
     prim.m_frozen = true;
     if (prim.prim_geom != IntPtr.Zero)
     {
         prim.DestroyBody();
         prim.IsPhysical = false;
         prim.m_targetSpace = IntPtr.Zero;
         try
         {
             if (prim.prim_geom != IntPtr.Zero)
             {
                 d.GeomDestroy(prim.prim_geom);
                 prim.prim_geom = IntPtr.Zero;
             }
             else
             {
                 MainConsole.Instance.Warn("[PHYSICS]: Unable to remove prim from physics scene");
             }
         }
         catch (AccessViolationException)
         {
             MainConsole.Instance.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed.");
         }
     }
     if (!prim.childPrim)
     {
         lock (prim.childrenPrim)
             foreach (AuroraODEPrim prm in prim.childrenPrim)
                 RemovePrimThreadLocked(prm);
     }
     if (prim.ParentEntity != null)
         prim.ParentEntity.PhysActor = null; //Delete it
     lock (_prims)
         _prims.Remove(prim);
 }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:47,代码来源:AODEPhysicsScene.cs


注:本文中的Aurora.Physics.AuroraOpenDynamicsEngine.AuroraODEPrim.DestroyBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。