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


C# BroadPhaseEntries.BroadPhaseEntry类代码示例

本文整理汇总了C#中BEPUphysics.BroadPhaseEntries.BroadPhaseEntry的典型用法代码示例。如果您正苦于以下问题:C# BroadPhaseEntry类的具体用法?C# BroadPhaseEntry怎么用?C# BroadPhaseEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BroadPhaseEntry类属于BEPUphysics.BroadPhaseEntries命名空间,在下文中一共展示了BroadPhaseEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {

            instancedMesh = entryA as InstancedMesh;
            convex = entryB as ConvexCollidable;

            if (instancedMesh == null || convex == null)
            {
                instancedMesh = entryB as InstancedMesh;
                convex = entryA as ConvexCollidable;

                if (instancedMesh == null || convex == null)
                    throw new Exception("Inappropriate types used to initialize pair.");
            }            
            
            //Contact normal goes from A to B.
            broadPhaseOverlap.entryA = convex;
            broadPhaseOverlap.entryB = instancedMesh;

            UpdateMaterialProperties(convex.entity != null ? convex.entity.material : null, instancedMesh.material);


            base.Initialize(entryA, entryB);



  

        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:34,代码来源:InstancedMeshPairHandler.cs

示例2: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {

            mobileMesh = entryA as MobileMeshCollidable;
            convex = entryB as ConvexCollidable;

            if (mobileMesh == null || convex == null)
            {
                mobileMesh = entryB as MobileMeshCollidable;
                convex = entryA as ConvexCollidable;

                if (mobileMesh == null || convex == null)
                    throw new ArgumentException("Inappropriate types used to initialize pair.");
            }


            //Contact normal goes from A to B.
            broadPhaseOverlap.entryA = convex;
            broadPhaseOverlap.entryB = mobileMesh;

            //It's possible that the convex does not have an entity if it is a proxy for a non-entity collidable.
            //Similarly, the mesh could be a query object.
            UpdateMaterialProperties(convex.entity != null ? convex.entity.material : null, mobileMesh.entity != null ? mobileMesh.entity.material : null);


            base.Initialize(entryA, entryB);

        }
开发者ID:dsmo7206,项目名称:Lemma,代码行数:33,代码来源:MobileMeshPairHandler.cs

示例3: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {

            terrain = entryA as Terrain;
            convex = entryB as ConvexCollidable;

            if (terrain == null || convex == null)
            {
                terrain = entryB as Terrain;
                convex = entryA as ConvexCollidable;

                if (terrain == null || convex == null)
                    throw new ArgumentException("Inappropriate types used to initialize pair.");
            }

            //Contact normal goes from A to B.
            broadPhaseOverlap.entryA = convex;
            broadPhaseOverlap.entryB = terrain;

            UpdateMaterialProperties(convex.entity != null ? convex.entity.material : null, terrain.material);

            base.Initialize(entryA, entryB);




        }
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:32,代码来源:TerrainPairHandler.cs

示例4: Remove

 public override void Remove(BroadPhaseEntry entry)
 {
     base.Remove(entry);
     entriesX.Remove(entry);
     entriesY.Remove(entry);
     entriesZ.Remove(entry);
 }
开发者ID:Indiefreaks,项目名称:igf,代码行数:7,代码来源:SortAndSweep3D.cs

示例5: Add

        /// <summary>
        /// Adds an entry to the broad phase.
        /// </summary>
        /// <param name="entry">Entry to add.</param>
        public override void Add(BroadPhaseEntry entry)
        {
            base.Add(entry);
            //Entities do not set up their own bounding box before getting stuck in here.  If they're all zeroed out, the tree will be horrible.
            Vector3 offset;
            Vector3.Subtract(ref entry.boundingBox.Max, ref entry.boundingBox.Min, out offset);
            if (offset.X * offset.Y * offset.Z == 0)
                entry.UpdateBoundingBox();
            //binary search for the approximately correct location.  This helps prevent large first-frame sort times.
            int minIndex = 0; //inclusive
            int maxIndex = entries.Count; //exclusive
            int index = 0;
            while (maxIndex - minIndex > 0)
            {
                index = (maxIndex + minIndex) / 2;
                if (entries.Elements[index].boundingBox.Min.X > entry.boundingBox.Min.X)
                    maxIndex = index;
                else if (entries.Elements[index].boundingBox.Min.X < entry.boundingBox.Min.X)
                    minIndex = ++index;
                else
                    break; //Found an equal value!

            }
            entries.Insert(index, entry);
        }
开发者ID:karrtmomil,项目名称:coms437_assignment2,代码行数:29,代码来源:SortAndSweep1D.cs

示例6: IgnoreThis

 public bool IgnoreThis(BroadPhaseEntry entry)
 {
     if (entry is EntityCollidable && ((EntityCollidable)entry).Entity == Entity)
     {
         return false;
     }
     return Collision.ShouldCollide(entry);
 }
开发者ID:Morphan1,项目名称:Voxalia,代码行数:8,代码来源:WheelStepUpConstraint.cs

示例7: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {

            //Child initialization is responsible for setting up the entries.
            //Child initialization is responsible for setting up the manifold, if any.
            manifoldConstraintGroup.Initialize(EntityA, EntityB);

            base.Initialize(entryA, entryB);
        }
开发者ID:dsmo7206,项目名称:Lemma,代码行数:14,代码来源:GroupPairHandler.cs

示例8: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {
            compoundInfoB = entryB as CompoundCollidable;
            if (compoundInfoB == null)
            {
                throw new ArgumentException("Inappropriate types used to initialize pair.");
            }

            base.Initialize(entryA, entryB);
        }
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:15,代码来源:CompoundPairHandler.cs

示例9: DontLandOnPlanes

 public bool DontLandOnPlanes(BroadPhaseEntry bpe)
 {
     if (bpe is EntityCollidable)
     {
         EntityCollidable ec = bpe as EntityCollidable;
         if (ec.Entity != null && (ec.Entity.Tag is PlayerEntity || ec.Entity.Tag is PlaneEntity))
         {
             return false;
         }
     }
     return true;
 }
开发者ID:Morphan1,项目名称:Voxalia,代码行数:12,代码来源:WingsItem.cs

示例10: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {
            //Child initialization is responsible for setting up the entries.

            ContactManifold.Initialize(CollidableA, CollidableB);
            ContactConstraint.Initialize(EntityA, EntityB, this);

            base.Initialize(entryA, entryB);



        }
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:17,代码来源:StandardPairHandler.cs

示例11: Initialize

 public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
 {
     base.Initialize(entryA, entryB);
     convex = entryA as ConvexCollidable;
     if (convex == null)
     {
         convex = entryB as ConvexCollidable;
         if (convex == null)
         {
             throw new ArgumentException("Incorrect types passed to pair handler.");
         }
     }
 }
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:13,代码来源:DetectorVolumeConvexPairHandler.cs

示例12: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {
            mesh = entryA as InstancedMesh;
            if (mesh == null)
            {
                mesh = entryB as InstancedMesh; 
                if (mesh == null)
                {
                    throw new ArgumentException("Inappropriate types used to initialize pair.");
                }
            }

            base.Initialize(entryA, entryB);
        }
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:19,代码来源:CompoundInstancedMeshPairHandler.cs

示例13: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {
            convexInfo = entryA as ConvexCollidable;
            if (convexInfo == null)
            {
                convexInfo = entryB as ConvexCollidable;
                if (convexInfo == null)
                {
                    throw new Exception("Inappropriate types used to initialize pair.");
                }
            }

            base.Initialize(entryA, entryB);
        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:19,代码来源:StaticGroupConvexPairHandler.cs

示例14: Add

        public override void Add(BroadPhaseEntry entry)
        {
            base.Add(entry);
            //binary search for the approximately correct location.  This helps prevent large first-frame sort times.
            //X Axis:
            int minIndex = 0; //inclusive
            int maxIndex = entriesX.Count; //exclusive
            int index = 0;
            while (maxIndex - minIndex > 0)
            {
                index = (maxIndex + minIndex) / 2;
                if (entriesX.Elements[index].boundingBox.Min.X > entry.boundingBox.Min.X)
                    maxIndex = index;
                else if (entriesX.Elements[index].boundingBox.Min.X < entry.boundingBox.Min.X)
                    minIndex = ++index;
                else
                    break; //Found an equal value!
            }
            entriesX.Insert(index, entry);

            //Y Axis:
            minIndex = 0; //inclusive
            maxIndex = entriesY.Count; //exclusive
            while (maxIndex - minIndex > 0)
            {
                index = (maxIndex + minIndex) / 2;
                if (entriesY.Elements[index].boundingBox.Min.Y > entry.boundingBox.Min.Y)
                    maxIndex = index;
                else if (entriesY.Elements[index].boundingBox.Min.Y < entry.boundingBox.Min.Y)
                    minIndex = ++index;
                else
                    break; //Found an equal value!
            }
            entriesY.Insert(index, entry);

            //Z Axis:
            minIndex = 0; //inclusive
            maxIndex = entriesZ.Count; //exclusive
            while (maxIndex - minIndex > 0)
            {
                index = (maxIndex + minIndex) / 2;
                if (entriesZ.Elements[index].boundingBox.Min.Z > entry.boundingBox.Min.Z)
                    maxIndex = index;
                else if (entriesZ.Elements[index].boundingBox.Min.Z < entry.boundingBox.Min.Z)
                    minIndex = ++index;
                else
                    break; //Found an equal value!
            }
            entriesZ.Insert(index, entry);
        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:50,代码来源:SortAndSweep3D.cs

示例15: Initialize

        ///<summary>
        /// Initializes the pair handler.
        ///</summary>
        ///<param name="entryA">First entry in the pair.</param>
        ///<param name="entryB">Second entry in the pair.</param>
        public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
        {
            //Other member of the pair is initialized by the child.
            staticGroup = entryA as StaticGroup;
            if (staticGroup == null)
            {
                staticGroup = entryB as StaticGroup;
                if (staticGroup == null)
                {
                    throw new Exception("Inappropriate types used to initialize pair.");
                }
            }

            base.Initialize(entryA, entryB);
        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:20,代码来源:StaticGroupPairHandler.cs


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