• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Cylinder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CharacterController

        /// <summary>
        /// Constructs a new character controller with the default configuration.
        /// </summary>
        public CharacterController()
        {
            Body = new Cylinder(Vector3.Zero, 3.0f, 1.2f, 10);
            Body.IgnoreShapeChanges = true; //Wouldn't want inertia tensor recomputations to occur when crouching and such.
            Body.CollisionInformation.Shape.CollisionMargin = .1f;

            //Making the character a continuous object prevents it from flying through walls which would be pretty jarring from a player's perspective.
            Body.PositionUpdateMode = PositionUpdateMode.Continuous;
            Body.LocalInertiaTensorInverse = new Matrix3X3();

            //TODO: In v0.16.2, compound bodies would override the material properties that get set in the CreatingPair event handler.
            //In a future version where this is changed, change this to conceptually minimally required CreatingPair.
            Body.CollisionInformation.Events.DetectingInitialCollision += RemoveFriction;
            Body.LinearDamping = 0;

            SupportFinder = new SupportFinder(this);
            HorizontalMotionConstraint = new HorizontalMotionConstraint(this);
            VerticalMotionConstraint = new VerticalMotionConstraint(this);
            StepManager = new StepManager(this);
            StanceManager = new StanceManager(this);
            QueryManager = new QueryManager(this);

            //Enable multithreading for the sphere characters.
            //See the bottom of the Update method for more information about using multithreading with this character.
            IsUpdatedSequentially = false;

            PhysicsManager.Space.Add(this);
        }
开发者ID:nasdf,项目名称:Boxel-Engine,代码行数:31,代码来源:CharacterController.cs


示例2: ExecuteFigureCreationCommand

    public override void ExecuteFigureCreationCommand(string[] splitFigString)
    {
        switch (splitFigString[0])
        {
            case "circle":
                {
                    Vector3D center = Vector3D.Parse(splitFigString[1]);
                    double radius = double.Parse(splitFigString[2]);

                    currentFigure = new Circle(center, radius);
                    break;
                }

            case "cylinder":
                {
                    Vector3D bottom = Vector3D.Parse(splitFigString[1]);
                    Vector3D top = Vector3D.Parse(splitFigString[2]);
                    double radius = double.Parse(splitFigString[3]);

                    currentFigure = new Cylinder(bottom, top, radius);
                    break;
                }
        }

        base.ExecuteFigureCreationCommand(splitFigString);
    }
开发者ID:dgrigorov,项目名称:TelerikAcademy-1,代码行数:26,代码来源:RoundedFigureController.cs


示例3: RayCastTestDemo

        /// <summary>
        /// Constructs a new demo.
        /// </summary>
        /// <param name="game">Game owning this demo.</param>
        public RayCastTestDemo(DemosGame game)
            : base(game)
        {
            Space.Add(new Box(new Vector3(0, -0.5f, 0), 50, 1, 50));

            //Put whatever you'd like to ray cast here.
            var capsule = new Capsule(new Vector3(0, 1.2f, 0), 1, 0.6f);
            capsule.AngularVelocity = new Vector3(1, 1, 1);
            Space.Add(capsule);

            var cylinder = new Cylinder(new Vector3(0, 5, 0), 2, .5f);
            cylinder.AngularVelocity = new Vector3(1, -1, 1);
            Space.Add(cylinder);

            var points = new List<Vector3>();

            var random = new Random(0);
            for (int k = 0; k < 40; k++)
            {
                points.Add(new Vector3(1 * (float)random.NextDouble(), 3 * (float)random.NextDouble(), 2 * (float)random.NextDouble()));
            }
            var convexHull = new ConvexHull(new Vector3(0, 10, 0), points);
            convexHull.AngularVelocity = new Vector3(-1, 1, 1);
            Space.Add(convexHull);


            game.Camera.Position = new Vector3(-10, 5, 10);
            game.Camera.Yaw((float)Math.PI / -4f);
            game.Camera.Pitch(-(float)Math.PI / 9f);

            //Starter ray.
            origin = new Vector3(10, 5, 0);
            direction = new Vector3(-3, -1, 0);

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


示例4: ParseQuery

        public static void ParseQuery(string path)
        {
            using (var file = new StreamReader(path))
            {
                Cylinder[] queryCylinders = new Cylinder[Int32.Parse(file.ReadLine())];
                file.ReadLine();
                file.ReadLine();

                for (int i = 0; i < queryCylinders.Length; i++)
                {
                    Cylinder curCylinder = new Cylinder();

                    string curCylinderString = file.ReadLine();
                    uint[] curCylinderUInt = new uint[curCylinderString.Length];
                    for (int j = 0; j < curCylinderUInt.Length; j++)
                    {
                        curCylinderUInt[j] = UInt32.Parse(curCylinderString[j].ToString());
                    }
                    curCylinder.Values = CylinderTestsHelper.ConvertArrayUintToBinary(curCylinderUInt);

                    curCylinder.Angle = Double.Parse(file.ReadLine());
                    curCylinder.Norm = Double.Parse(file.ReadLine());

                    queryCylinders[i] = curCylinder;

                    file.ReadLine();
                }

                query = new Template(queryCylinders);
            }
        }
开发者ID:SeriousCoder,项目名称:CUDA-Fingerprinting,代码行数:31,代码来源:BinTemplateSimilarityTests.cs


示例5: Run

        public static void Run()
        {
            // Initialize scene object
            Scene scene = new Scene();
            
            // Initialize Node class object
            Node cubeNode = new Node("cylinder");

            // ExStart:ConvertCylinderPrimitivetoMesh
            // Initialize object by Cylinder class
            IMeshConvertible convertible = new Cylinder();
            
            // Convert a Cylinder to Mesh
            Mesh mesh = convertible.ToMesh();
            // ExEnd:ConvertCylinderPrimitivetoMesh

            // Point node to the Mesh geometry
            cubeNode.Entity = mesh;

            // Add Node to a scene
            scene.RootNode.ChildNodes.Add(cubeNode);

            // The path to the documents directory.
            string MyDir = RunExamples.GetDataDir() + RunExamples.GetOutputFilePath("CylinderToMeshScene.fbx");

            // Save 3D scene in the supported file formats
            scene.Save(MyDir, FileFormat.FBX7400ASCII);

            Console.WriteLine("\n Converted the primitive Cylinder to a mesh successfully.\nFile saved at " + MyDir);
        }
开发者ID:aspose-3d,项目名称:Aspose.3D-for-.NET,代码行数:30,代码来源:ConvertCylinderPrimitivetoMesh.cs


示例6: 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="proneHeight">Prone 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, float proneHeight, QueryManager queryManager, SupportFinder supportFinder)
        {
            this.QueryManager = queryManager;
            this.SupportFinder = supportFinder;
            this.characterBody = characterBody;
            standingHeight = characterBody.Height;
            if (crouchingHeight < standingHeight)
                this.crouchingHeight = crouchingHeight;
            else
                throw new ArgumentException("Crouching height must be less than standing height.");
            if (proneHeight < crouchingHeight)
                this.proneHeight = proneHeight;
            else
                throw new ArgumentException("Prone height must be less than crouching 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) { CollisionMargin = currentQueryObject.Shape.CollisionMargin });
            crouchingQueryObject = new ConvexCollidable<CylinderShape>(new CylinderShape(CrouchingHeight, characterBody.Radius) { CollisionMargin = currentQueryObject.Shape.CollisionMargin });
            proneQueryObject = new ConvexCollidable<CylinderShape>(new CylinderShape(proneHeight, characterBody.Radius) { CollisionMargin = currentQueryObject.Shape.CollisionMargin });
            //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;
            proneQueryObject.CollisionRules = characterBody.CollisionInformation.CollisionRules;
        }
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:34,代码来源:StanceManager.cs


示例7: BuildStick

        void BuildStick(Vector3 position, int linkCount, out List<Bone> bones, out List<Entity> boneEntities)
        {
            //Set up a bone chain.
            bones = new List<Bone>();
            boneEntities = new List<Entity>();
            var previousBoneEntity = new Cylinder(position, 1, .2f);
            var previousBone = new Bone(previousBoneEntity.Position, previousBoneEntity.Orientation, previousBoneEntity.Radius, previousBoneEntity.Height);
            bones.Add(previousBone);
            boneEntities.Add(previousBoneEntity);

            
            for (int i = 1; i < linkCount; i++)
            {
                var boneEntity = new Cylinder(previousBone.Position + new Vector3(0, 1, 0), 1, .2f);
                var bone = new Bone(boneEntity.Position, boneEntity.Orientation, boneEntity.Radius, boneEntity.Height);
                bones.Add(bone);
                boneEntities.Add(boneEntity);

                //Make a relationship between the two bones and entities.
                CollisionRules.AddRule(previousBoneEntity, boneEntity, CollisionRule.NoBroadPhase);
                Vector3 anchor = (previousBoneEntity.Position + boneEntity.Position) / 2;
                //var dynamicsBallSocketJoint = new BallSocketJoint(previousBoneEntity, boneEntity, anchor);
                //var dynamicsAngularFriction = new NoRotationJoint(previousBoneEntity, boneEntity);
                //Space.Add(dynamicsBallSocketJoint);
                //Space.Add(dynamicsAngularFriction);
                var ballSocket = new IKBallSocketJoint(previousBone, bone, anchor);
                var angularJoint = new IKAngularJoint(previousBone, bone);

   
                previousBone = bone;
                previousBoneEntity = boneEntity;
            }
        }
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:33,代码来源:InverseKinematicsTestDemo2.cs


示例8: ExecuteFigureCreationCommand

    public override void ExecuteFigureCreationCommand(string[] splitFigString)
    {
        switch (splitFigString[0])
        {
            case "circle":
                {
                    Vector3D a = Vector3D.Parse(splitFigString[1]);
                    double b = double.Parse(splitFigString[2]);
                    currentFigure = new Circle(a, b);
                    break;
                }
            case "cylinder":
                {
                    Vector3D a = Vector3D.Parse(splitFigString[1]);
                    Vector3D b = Vector3D.Parse(splitFigString[2]);
                    double r = double.Parse(splitFigString[3]);
                    currentFigure = new Cylinder(a, b, r);
                    break;
                }
            default:
                {
                    base.ExecuteFigureCreationCommand(splitFigString);
                    break;
                }
        }

        this.EndCommandExecuted = false;
    }
开发者ID:Jarolim,项目名称:HomeWork,代码行数:28,代码来源:RoundedFigureController.cs


示例9: CharacterController

        /// <summary>
        /// Constructs a new character controller with the most common configuration options.
        /// </summary>
        /// <param name="position">Initial position of the character.</param>
        /// <param name="height">Height of the character body while standing.</param>
        /// <param name="crouchingHeight">Height of the character body while crouching.</param>
        /// <param name="radius">Radius of the character body.</param>
        /// <param name="mass">Mass of the character body.</param>
        public CharacterController(Vector3 position, float height, float crouchingHeight, float radius, float mass)
        {
            Body = new Cylinder(position, height, radius, mass);
            Body.IgnoreShapeChanges = true; //Wouldn't want inertia tensor recomputations to occur when crouching and such.
            Body.CollisionInformation.Shape.CollisionMargin = .1f;
            //Making the character a continuous object prevents it from flying through walls which would be pretty jarring from a player's perspective.
            Body.PositionUpdateMode = PositionUpdateMode.Continuous;
            Body.LocalInertiaTensorInverse = new Matrix3X3();
            //TODO: In v0.16.2, compound bodies would override the material properties that get set in the CreatingPair event handler.
            //In a future version where this is changed, change this to conceptually minimally required CreatingPair.
            Body.CollisionInformation.Events.DetectingInitialCollision += RemoveFriction;
            Body.LinearDamping = 0;
            SupportFinder = new SupportFinder(this);
            HorizontalMotionConstraint = new HorizontalMotionConstraint(this);
            VerticalMotionConstraint = new VerticalMotionConstraint(this);
            StepManager = new StepManager(this);
            StanceManager = new StanceManager(this, crouchingHeight);
            QueryManager = new QueryManager(this);

            //Enable multithreading for the characters.
            IsUpdatedSequentially = false;
            //Link the character body to the character controller so that it can be identified by the locker.
            //Any object which replaces this must implement the ICharacterTag for locking to work properly.
            Body.CollisionInformation.Tag = new CharacterSynchronizer(Body);
        }
开发者ID:gpforde,项目名称:GPBrakes,代码行数:33,代码来源:CharacterController.cs


示例10: GoalPostObject

 public GoalPostObject(Vector3 p, Model m, int h, float r)
 {
     position = p;
     model = m;
     post1 = new Cylinder(new Vector3(p.X - 6.5f, h / 2, p.Z), h, r);
     post2 = new Cylinder(new Vector3(p.X + 6.5f, h / 2, p.Z), h, r);
 }
开发者ID:niallsull,项目名称:Hurling-Challenge-Kinect-3rd-Year-Project,代码行数:7,代码来源:GoalPostObject.cs


示例11: GenerateTemplateDb

        public static void GenerateTemplateDb(
            int givenCylinderDbCount, int givenTemplateDbCount, int givenCylinderCellsCount)
        {
            cylinderDbCount = givenCylinderDbCount;
            templateDbCount = givenTemplateDbCount;
            cylinderCellsCount = givenCylinderCellsCount;

            db = new Cylinder[cylinderDbCount];
            templateIndices = new int[cylinderDbCount];
            templateDbLengths = new int[templateDbCount];

            for (int i = 0; i < cylinderDbCount; i++)
            {
                Cylinder curCylinder = new Cylinder();

                // For further randomness (so that cylinders don't have very similar norms)
                double curThreshold = rnd.NextDouble();

                uint[] curCylinderValues = new uint[cylinderCellsCount];
                for (int j = 0; j < cylinderCellsCount; j++)
                {
                    double x = rnd.NextDouble();
                    curCylinderValues[j] = x < curThreshold ? (uint)0 : 1; // Cast necessary? o_o
                }
                curCylinder.Values = curCylinderValues;

                curCylinder.Angle = rnd.NextDouble() * 2 * Math.PI;
                curCylinder.Norm = CylinderHelper.CalculateCylinderNorm(curCylinder.Values);

                db[i] = curCylinder;
            }

            // Thresholds again for further randomness (not a uniform distribution between templates)
            double[] templateThresholds = new double[templateDbCount - 1];
            for (int i = 0; i < templateDbCount - 1; i++)
            {
                templateThresholds[i] = rnd.NextDouble();
            }

            for (int i = 0; i < cylinderDbCount; i++)
            {
                double x = rnd.NextDouble();

                int curTemplateIndex = 0;
                for (int j = 0; j < templateDbCount - 1; j++)
                {
                    if (x > templateThresholds[j])
                    {
                        curTemplateIndex++;
                    }
                }

                templateIndices[i] = curTemplateIndex;
                templateDbLengths[curTemplateIndex]++;
            }
        }
开发者ID:SeriousCoder,项目名称:CUDA-Fingerprinting,代码行数:56,代码来源:TemplateDbGenerator.cs


示例12: Main

        public static void Main(string[] args)
        {
            // Test Program for Lab401
            Circle c1 = new Circle(), c2 = new Circle(1.5, 5.0, 2), c3 = new Circle(c2);
            Console.WriteLine(c1 + "\n" + c2 + "\n" + c3);

            Cylinder cl1 = new Cylinder(), cl2 = new Cylinder(c3), cl3 = new Cylinder(1, 1, 3, 4);
            Cylinder cl4 = new Cylinder(cl3);
            Console.WriteLine(cl1 + "\n" + cl2 + "\n" + cl3 + "\n" + cl4);
        }
开发者ID:nutisne2,项目名称:week-4,代码行数:10,代码来源:Program.cs


示例13: Main

 static void Main()
 {
     double r = 3.0, h = 5.0;
         Shape c = new Circle(r);
         Shape s = new Sphere(r);
         Shape l = new Cylinder(r, h);
         // Display results:
         Console.WriteLine("Area of Circle   = {0:F2}", c.Area());
         Console.WriteLine("Area of Sphere   = {0:F2}", s.Area());
         Console.WriteLine("Area of Cylinder = {0:F2}", l.Area());
 }
开发者ID:terryjintry,项目名称:OLSource1,代码行数:11,代码来源:virtual--csharp-reference-_2.cs


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


示例15: CylinderObject

        public CylinderObject(Vector3 pos, float altura, float raio, Vector3? scale = null, float mass = 10,Matrix? orientation = null,MaterialDescription md=null)
            : base(md,mass)
        {
            if (!orientation.HasValue)
                orientation = Matrix.Identity;

            if (!scale.HasValue)
                scale = Vector3.One;

            entity = new Cylinder(pos, altura * scale.Value.Y, raio * scale.Value.X, mass);
            this.scale = scale.Value;
            entity.Orientation = Quaternion.CreateFromRotationMatrix(orientation.Value);            
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:13,代码来源:CylinderObject.cs


示例16: Main

    public static void Main()
    {
        double r = 3.0, h = 5.0;
        Dimensions c = new Circle(r);
        Dimensions s = new Sphere(r);
        Dimensions l = new Cylinder(r, h);

        Console.WriteLine("Area of Circle   = {0}", string.Format("{0:0.00}", c.Area()));
        Console.WriteLine("Area of Sphere   = {0}", string.Format("{0:0.00}", s.Area()));
        Console.WriteLine("Area of Cylinder = {0}", string.Format("{0:0.00}", l.Area()));

        Console.ReadLine();
    }
开发者ID:Nagato23,项目名称:CsBasic,代码行数:13,代码来源:virtualTest.cs


示例17: Execute

        public override void Execute(ref WooState state)
        {
            if (state._Objects > 0)
            {
                state._Objects--;
                Vector3 val = new Vector3(0.0, 0.5, 0.0);
                val.y *= state._Scale.y;
                val.Mul(state._Rotation);

                Cylinder newCylinder = new Cylinder(new Vector3(state._Position.x + val.x, state._Position.y + val.y, state._Position.z + val.z), state._Scale * 0.5, state._Rotation);
                newCylinder._Material = GenerateMaterial(state);
                newCylinder.CreateElement(state._Preview, state._Parent);
            }
        }
开发者ID:dom767,项目名称:woofractal,代码行数:14,代码来源:CylinderRule.cs


示例18: CharacterController

        /// <summary>
        /// Constructs a new character controller.
        /// </summary>
        /// <param name="position">Initial position of the character.</param>
        /// <param name="height">Height of the character body while standing.</param>
        /// <param name="crouchingHeight">Height of the character body while crouching.</param>
        /// <param name="proneHeight">Height of the character body while prone.</param>
        /// <param name="radius">Radius of the character body.</param>
        /// <param name="margin">Radius of 'rounding' applied to the cylindrical body. Higher values make the cylinder's edges more rounded.
        /// The margin is contained within the cylinder's height and radius, so it must not exceed the radius or height of the cylinder.
        /// To change the collision margin later, use the CharacterController.CollisionMargin property.</param>
        /// <param name="mass">Mass of the character body.</param>
        /// <param name="maximumTractionSlope">Steepest slope, in radians, that the character can maintain traction on.</param>
        /// <param name="maximumSupportSlope">Steepest slope, in radians, that the character can consider a support.</param>
        /// <param name="standingSpeed">Speed at which the character will try to move while crouching with a support that provides traction.
        /// Relative velocities with a greater magnitude will be decelerated.</param>
        /// <param name="crouchingSpeed">Speed at which the character will try to move while crouching with a support that provides traction.
        /// Relative velocities with a greater magnitude will be decelerated.</param>
        /// <param name="proneSpeed">Speed at which the character will try to move while prone with a support that provides traction.
        /// Relative velocities with a greater magnitude will be decelerated.</param>
        /// <param name="tractionForce">Maximum force that the character can apply while on a support which provides traction.</param>
        /// <param name="slidingSpeed">Speed at which the character will try to move while on a support that does not provide traction.
        /// Relative velocities with a greater magnitude will be decelerated.</param>
        /// <param name="slidingForce">Maximum force that the character can apply while on a support which does not provide traction</param>
        /// <param name="airSpeed">Speed at which the character will try to move with no support.
        /// The character will not be decelerated while airborne.</param>
        /// <param name="airForce">Maximum force that the character can apply with no support.</param>
        /// <param name="jumpSpeed">Speed at which the character leaves the ground when it jumps</param>
        /// <param name="slidingJumpSpeed">Speed at which the character leaves the ground when it jumps without traction</param>
        /// <param name="maximumGlueForce">Maximum force the vertical motion constraint is allowed to apply in an attempt to keep the character on the ground.</param>
        public CharacterController(
            Vector3 position = new Vector3(),
            float height = 1.7f, float crouchingHeight = 1.7f * .7f, float proneHeight = 1.7f * 0.3f, float radius = 0.6f, float margin = 0.1f, float mass = 10f,
            float maximumTractionSlope = 0.8f, float maximumSupportSlope = 1.3f,
            float standingSpeed = 8f, float crouchingSpeed = 3f, float proneSpeed = 1.5f, float tractionForce = 1000, float slidingSpeed = 6, float slidingForce = 50, float airSpeed = 1, float airForce = 250,
            float jumpSpeed = 4.5f, float slidingJumpSpeed = 3,
            float maximumGlueForce = 5000
            )
        {
            if (margin > radius || margin > crouchingHeight || margin > height)
                throw new ArgumentException("Margin must not be larger than the character's radius or height.");

            Body = new Cylinder(position, height, radius, mass);
            Body.IgnoreShapeChanges = true; //Wouldn't want inertia tensor recomputations to occur when crouching and such.
            Body.CollisionInformation.Shape.CollisionMargin = margin;
            //Making the character a continuous object prevents it from flying through walls which would be pretty jarring from a player's perspective.
            Body.PositionUpdateMode = PositionUpdateMode.Continuous;
            Body.LocalInertiaTensorInverse = new Matrix3x3();
            //TODO: In v0.16.2, compound bodies would override the material properties that get set in the CreatingPair event handler.
            //In a future version where this is changed, change this to conceptually minimally required CreatingPair.
            Body.CollisionInformation.Events.DetectingInitialCollision += RemoveFriction;
            Body.LinearDamping = 0;
            ContactCategorizer = new CharacterContactCategorizer(maximumTractionSlope, maximumSupportSlope);
            QueryManager = new QueryManager(Body, ContactCategorizer);
            SupportFinder = new SupportFinder(Body, QueryManager, ContactCategorizer);
            HorizontalMotionConstraint = new HorizontalMotionConstraint(Body, SupportFinder);
            HorizontalMotionConstraint.PositionAnchorDistanceThreshold = radius * 0.25f;
            VerticalMotionConstraint = new VerticalMotionConstraint(Body, SupportFinder, maximumGlueForce);
            StepManager = new StepManager(Body, ContactCategorizer, SupportFinder, QueryManager, HorizontalMotionConstraint);
            StanceManager = new StanceManager(Body, crouchingHeight, proneHeight, QueryManager, SupportFinder);
            PairLocker = new CharacterPairLocker(Body);

            StandingSpeed = standingSpeed;
            CrouchingSpeed = crouchingSpeed;
            ProneSpeed = proneSpeed;
            TractionForce = tractionForce;
            SlidingSpeed = slidingSpeed;
            SlidingForce = slidingForce;
            AirSpeed = airSpeed;
            AirForce = airForce;
            JumpSpeed = jumpSpeed;
            SlidingJumpSpeed = slidingJumpSpeed;

            //Enable multithreading for the characters.
            IsUpdatedSequentially = false;
            //Link the character body to the character controller so that it can be identified by the locker.
            //Any object which replaces this must implement the ICharacterTag for locking to work properly.
            Body.CollisionInformation.Tag = new CharacterSynchronizer(Body);
        }
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:79,代码来源:CharacterController.cs


示例19: testClass

        // 类
        public void testClass()
        {
            MyClass p1 = new MyClass();
            MyClass p2 = new MyClass(6, 7);

            Console.WriteLine("CoOrds #1 at {0}", p1);
            Console.WriteLine("CoOrds #2 at {0}", p2);

            Circle ring = new Circle(2);
            Cylinder tube = new Cylinder(2, 3);

            Console.WriteLine("Area of the circle = {0:F2}", ring.Area());
            Console.WriteLine("Area of the cylinder = {0:F2}", tube.Area());

            TimePeriod ti = new TimePeriod(3600*5);
            Console.WriteLine("Setid time is {0}", ti.hours);

            ShapeStatic.TestSe();
        }
开发者ID:howard1982,项目名称:csharp,代码行数:20,代码来源:Program.cs


示例20: ParseDb

        public static void ParseDb(string path)
        {
            using (var file = new StreamReader(path))
            {
                string[] templateDbLengthsString = file.ReadLine().Split(new Char[] { ' ' });
                templateDbLengths = new int[templateDbLengthsString.Length];
                for (int i = 0; i < templateDbLengthsString.Length; i++)
                {

                    templateDbLengths[i] = Int32.Parse(templateDbLengthsString[i]);
                }

                string[] templateIndicesString = file.ReadLine().Split(new Char[] { ' ' });
                templateIndices = new uint[templateIndicesString.Length];
                for (int i = 0; i < templateIndicesString.Length; i++)
                {
                    templateIndices[i] = UInt32.Parse(templateIndicesString[i]);
                }

                file.ReadLine();

                contiguousCylinders = new Cylinder[templateIndices.Length];
                for (int i = 0; i < templateIndices.Length; i++)
                {
                    Cylinder curCylinder = new Cylinder();

                    string curCylinderString = file.ReadLine();
                    uint[] curCylinderUInt = new uint[curCylinderString.Length];
                    for (int j = 0; j < curCylinderUInt.Length; j++)
                    {
                        curCylinderUInt[j] = UInt32.Parse(curCylinderString[j].ToString());
                    }
                    curCylinder.Values = CylinderTestsHelper.ConvertArrayUintToBinary(curCylinderUInt);

                    curCylinder.Angle = Double.Parse(file.ReadLine());
                    curCylinder.Norm = Double.Parse(file.ReadLine());

                    contiguousCylinders[i] = curCylinder;

                    file.ReadLine();
                }
            }
        }
开发者ID:SeriousCoder,项目名称:CUDA-Fingerprinting,代码行数:43,代码来源:BinTemplateSimilarityTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CypherFluentQuery类代码示例发布时间:2022-05-24
下一篇:
C# Cyberware类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap