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


C# MobileCollidables.ConvexCollidable类代码示例

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


ConvexCollidable类属于BEPUphysics.BroadPhaseEntries.MobileCollidables命名空间,在下文中一共展示了ConvexCollidable类的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)
        {

            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

示例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)
        {


            box = entryA as ConvexCollidable<BoxShape>;
            sphere = entryB as ConvexCollidable<SphereShape>;

            if (box == null || sphere == null)
            {
                box = entryB as ConvexCollidable<BoxShape>;
                sphere = entryA as ConvexCollidable<SphereShape>;
                if (box == null || sphere == null)
                {
                    throw new Exception("Inappropriate types used to initialize pair.");
                }
            }

            //Reorder the entries so that the guarantee that the normal points from A to B is satisfied.
            broadPhaseOverlap.entryA = box;
            broadPhaseOverlap.entryB = sphere;
            
            base.Initialize(entryA, entryB);


        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:30,代码来源:BoxSpherePairHandler.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: 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

示例5: QueryManager

        /// <summary>
        /// Constructs the query manager for a character.
        /// </summary>
        /// <param name="character">Character to manage queries for.</param>
        public QueryManager(SphereCharacterController character)
        {
            this.character = character;
            //We can share the real shape with the 'current' query object.
            queryObject = new ConvexCollidable<SphereShape>(character.Body.CollisionInformation.Shape);
            //Share the collision rules between the main body and its query objects.  That way, the character's queries return valid results.
            queryObject.CollisionRules = character.Body.CollisionInformation.CollisionRules;

            SupportRayFilter = SupportRayFilterFunction;
        }
开发者ID:karrtmomil,项目名称:coms437_assignment2,代码行数:14,代码来源:QueryManager.cs

示例6: StepManager

        float upStepMargin = .1f; //There's a little extra space above the maximum step height to start the obstruction and downcast test rays.  Helps when a step is very close to the max step height.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructs a new step manager for a character.
        /// </summary>
        /// <param name="characterBody">The character's body.</param>
        /// <param name="contactCategorizer">Contact categorizer used by the character.</param>
        /// <param name="supportFinder">Support finder used by the character.</param>
        /// <param name="queryManager">Query provider to use in checking for obstructions.</param>
        /// <param name="horizontalMotionConstraint">Horizontal motion constraint used by the character. Source of 3d movement direction.</param>
        public StepManager(Cylinder characterBody, CharacterContactCategorizer contactCategorizer, SupportFinder supportFinder, QueryManager queryManager, HorizontalMotionConstraint horizontalMotionConstraint)
        {
            this.characterBody = characterBody;
            currentQueryObject = new ConvexCollidable<CylinderShape>(characterBody.CollisionInformation.Shape);
            ContactCategorizer = contactCategorizer;
            SupportFinder = supportFinder;
            QueryManager = queryManager;
            HorizontalMotionConstraint = horizontalMotionConstraint;
            //The minimum step height is just barely above where the character would generally find the ground.
            //This helps avoid excess tests.
            minimumUpStepHeight = CollisionDetectionSettings.AllowedPenetration * 1.1f;// Math.Max(0, -.01f + character.Body.CollisionInformation.Shape.CollisionMargin * (1 - character.SupportFinder.sinMaximumSlope));
        }
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:26,代码来源:StepManager.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)
        {
            convexA = entryA as ConvexCollidable;
            convexB = entryB as ConvexCollidable;

            if (convexA == null || convexB == null)
            {
                throw new ArgumentException("Inappropriate types used to initialize pair.");
            }

            base.Initialize(entryA, entryB);
        }
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:17,代码来源:GeneralConvexPairHandler.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)
        {
            boxA = entryA as ConvexCollidable<BoxShape>;
            boxB = entryB as ConvexCollidable<BoxShape>;

            if (boxA == null || boxB == null)
            {
                throw new Exception("Inappropriate types used to initialize pair.");
            }

            base.Initialize(entryA, entryB);

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

示例9: 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

示例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)
        {


            sphereA = entryA as ConvexCollidable<SphereShape>;
            sphereB = entryB as ConvexCollidable<SphereShape>;

            if (sphereA == null || sphereB == null)
            {
                throw new ArgumentException("Inappropriate types used to initialize pair.");
            }

            base.Initialize(entryA, entryB);

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

示例11: 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)
        {
            triangle = entryA as ConvexCollidable<TriangleShape>;
            convex = entryB as ConvexCollidable;

            if (triangle == null || convex == null)
            {
                triangle = entryB as ConvexCollidable<TriangleShape>;
                convex = entryA as ConvexCollidable;

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

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

            base.Initialize(entryA, entryB);
        }
开发者ID:karrtmomil,项目名称:coms437_assignment2,代码行数:25,代码来源:TriangleConvexPairHandler.cs

示例12: StanceManager

        /// <summary>
        /// Constructs a stance manager for a character.
        /// </summary>
        /// <param name="characterBody">The character's body entity.</param>
        /// <param name="crouchingHeight">Crouching height of the character.</param>
        /// <param name="queryManager">Provider of queries used by the stance manager to test if it is okay to change stances.</param>
        /// <param name="supportFinder">Support finder used by the character.</param>
        public StanceManager(Cylinder characterBody, float crouchingHeight, QueryManager queryManager, SupportFinder supportFinder)
        {
            this.QueryManager = queryManager;
            this.SupportFinder = supportFinder;
            this.characterBody = characterBody;
            standingHeight = characterBody.Height;
            if (crouchingHeight < standingHeight)
                this.crouchingHeight = StandingHeight * .7f;
            else
                throw new ArgumentException("Crouching height must be less than standing height.");

            //We can share the real shape with the query objects.
            currentQueryObject = new ConvexCollidable<CylinderShape>(characterBody.CollisionInformation.Shape);
            standingQueryObject = new ConvexCollidable<CylinderShape>(new CylinderShape(StandingHeight, characterBody.Radius));
            crouchingQueryObject = new ConvexCollidable<CylinderShape>(new CylinderShape(CrouchingHeight, characterBody.Radius));
            //Share the collision rules between the main body and its query objects.  That way, the character's queries return valid results.
            currentQueryObject.CollisionRules = characterBody.CollisionInformation.CollisionRules;
            standingQueryObject.CollisionRules = characterBody.CollisionInformation.CollisionRules;
            crouchingQueryObject.CollisionRules = characterBody.CollisionInformation.CollisionRules;
        }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:27,代码来源:StanceManager.cs

示例13: CleanUp

        ///<summary>
        /// Cleans up the pair handler.
        ///</summary>
        public override void CleanUp()
        {
            base.CleanUp();

            triangle = null;
            convex = null;
        }
开发者ID:karrtmomil,项目名称:coms437_assignment2,代码行数:10,代码来源:TriangleConvexPairHandler.cs

示例14: CleanUp

        ///<summary>
        /// Cleans up the pair handler.
        ///</summary>
        public override void CleanUp()
        {
            base.CleanUp();

            terrain = null;
            convex = null;
        }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:10,代码来源:TerrainPairHandler.cs

示例15: CleanUp

        ///<summary>
        /// Cleans up the pair handler.
        ///</summary>
        public override void CleanUp()
        {
            base.CleanUp();

            convexA = null;
            convexB = null;
        }
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:10,代码来源:GeneralConvexPairHandler.cs


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