コード例 #1
0
ファイル: Floor.cs プロジェクト: Sweetwater/DestructionXNA
        public Floor(DestructionXNA game, Model model)
            : base(game)
        {
            this.game = game;
            this.model = model;

            this.physicsObject = new PhysicsObject("Floor");
            this.physicsObject.SetCreateProperty(1.0f, 0.2f, 0.7f, 0.6f);
            this.physicsObject.CreatePlane(Vector3.Up, 0);
            this.physicsObject.Body.Immovable = true;
        }
コード例 #2
0
        public BaseBlock(DestructionXNA game, Model model, BlockType type)
            : base(game)
        {
            this.game = game;
            this.model = model;
            this.type = type;

            physicsObject = new PhysicsObject(type.ToString());
            CreatePhysicsBody();
            physicsObject.Body.AllowFreezing = true;
        }
コード例 #3
0
        public NicoNicoTVChan(DestructionXNA game, Model model)
            : base(game)
        {
            this.game = game;
            this.model = model;

            this.physicsObject = new PhysicsObject("NicoNicoTVChan");
            PhysicsObject po = this.physicsObject;
            po.SetCreateProperty(2, 2f, 1f, 1f);
            po.CreateBox(Vector3.Zero, Matrix.Identity, length);
            po.Body.AllowFreezing = false;
        }
コード例 #4
0
        public void Draw(PhysicsObject physicsObject)
        {
            if (game.DebugDrawer.Enabled)
            {
                VertexPositionColor[] wf;
                 wf = physicsObject.Body.CollisionSkin.GetLocalSkinWireframe();

                // if the collision skin was also added to the body
                // we have to transform the skin wireframe to the body space
                 if (physicsObject.Body.CollisionSkin != null)
                {
                    physicsObject.Body.TransformWireframe(wf);
                }

                game.DebugDrawer.DrawShape(wf);
            }
        }
コード例 #5
0
ファイル: Beam.cs プロジェクト: Sweetwater/DestructionXNA
        private void InitializePhysicsObject()
        {
            this.physicsObject = new PhysicsObject("Beam");

            int textureWidth = 512;
            int textureHeight = 128;

            boxSplitLength.X = boxBaseLength.X;
            boxSplitLength.Y = boxBaseLength.Y * texture.Height / textureHeight;
            boxSplitLength.Z = boxSplitLengthZ * texture.Width / textureWidth;

            CreateCollision();
            physicsObject.Body.ApplyGravity = false;
            physicsObject.Body.AllowFreezing = false;

            DisableCollision();
        }