Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a new demo.
        /// </summary>
        /// <param name="game">Game owning this demo.</param>
        public RagdollDemo(DemosGame game)
            : base(game)
        {
            int   numRows    = 8;
            int   numColumns = 3;
            Fix64 xSpacing   = 5;
            Fix64 zSpacing   = 5;

            for (int i = 0; i < numRows; i++)
            {
                for (int j = 0; j < numColumns; j++)
                {
                    Ragdoll ragdoll = new Ragdoll();
                    //Transform and add every bone.
                    foreach (var bone in ragdoll.Bones)
                    {
                        bone.WorldTransform *= Matrix.CreateTranslation(new Vector3(
                                                                            i * xSpacing - (numRows - 1) * xSpacing / 2,
                                                                            i - 1.5m,
                                                                            j * zSpacing - (numColumns - 1) * zSpacing / 2));
                        Space.Add(bone);
                    }

                    //Add every constraint.
                    foreach (var joint in ragdoll.Joints)
                    {
                        Space.Add(joint);
                    }
                }
            }

            //Add some ground.
            Space.Add(new Box(new Vector3(0, -3.5m, 0), 50, 1, 50));

            game.Camera.Position      = new Vector3(0, 5, -35);
            game.Camera.ViewDirection = new Vector3(0, 0, 1);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs a new demo.
        /// </summary>
        /// <param name="game">Game owning this demo.</param>
        public RagdollDemo(DemosGame game)
            : base(game)
        {
            int numRows = 8;
            int numColumns = 3;
            float xSpacing = 5;
            float zSpacing = 5;
            for (int i = 0; i < numRows; i++)
            {
                for (int j = 0; j < numColumns; j++)
                {
                    Ragdoll ragdoll = new Ragdoll();
                    //Transform and add every bone.
                    foreach (var bone in ragdoll.Bones)
                    {
                        bone.WorldTransform *= Matrix.CreateTranslation(new Vector3(
                                                         i * xSpacing - (numRows - 1) * xSpacing / 2,
                                                         i - 1.5f,
                                                         j * zSpacing - (numColumns - 1) * zSpacing / 2));
                        Space.Add(bone);
                    }

                    //Add every constraint.
                    foreach (var joint in ragdoll.Joints)
                    {
                        Space.Add(joint);
                    }
                }
            }

            //Add some ground.
            Space.Add(new Box(new Vector3(0, -3.5f, 0), 50f, 1, 50f));

            game.Camera.Position = new Vector3(0, 5, -35);
            game.Camera.ViewDirection = new Vector3(0, 0, 1);
        }