示例#1
0
        /// <summary>
        /// The load content.
        /// </summary>
        protected override void LoadContent()
        {
            GddModel gddModel = ModelManager.LoadModel(this.modelName, this.Game, this.ScaleMatrix * this.Rotation);

            this.ObjectModel   = gddModel.Model;
            this.ModelTextures = gddModel.Textures;

            ShaderManager.AddEffect(ShaderManager.EFFECT_ID.ANIMATEDMODEL, "Effects\\AnimatedModel", this.Game);
            this.DefaultEffectID  = ShaderManager.EFFECT_ID.ANIMATEDMODEL;
            this.DefaultTechnique = "AnimatedModelTechnique";
            this.AnimationPlayer  = new ModelAnimationPlayer(this.ObjectModel.Tag as SkinningData);

            this.skinningData = (SkinningData)this.ObjectModel.Tag;

            this.AnimationPlayer.SetClip((this.ObjectModel.Tag as SkinningData).AnimationClips.Values.First());
            this.AnimationPlayer.StartClip();
            this.AnimationPlayer.StepClip();

            this.currentPhysicsVertices =
                this.AnimationPlayer.CurrentClip.vertices[(int)this.ModelDirection][this.AnimationPlayer.CurrentKeyframe];

            this.PhysicsVertices = this.currentPhysicsVertices;

            this.LoadCommonContent();

            this.PhysicsBody.Mass                    = 70.0f;
            this.PhysicsBody.MomentOfInertia         = float.MaxValue;
            this.PhysicsGeometry.FrictionCoefficient = 10.0f;
            this.PhysicsBody.IsStatic                = false;
        }
示例#2
0
        /// <summary>
        /// The load content.
        /// </summary>
        protected override void LoadContent()
        {
            this.offset = Vector2.Zero;
            GddModel gddModel = ModelManager.LoadModel(this.modelName, this.Game, this.ScaleMatrix * Matrix.CreateFromYawPitchRoll(this.YawRotation, 0.0f, 0.0f));

            this.ObjectModel = gddModel.Model;
            this.ModelTextures.Clear();
            this.ModelTextures.AddRange(gddModel.Textures);

            ShaderManager.AddEffect(ShaderManager.EFFECT_ID.STATICMODEL, "Effects\\StaticModel", this.Game);
            this.DefaultEffectID  = ShaderManager.EFFECT_ID.STATICMODEL;
            this.DefaultTechnique = "StaticModelTechnique";

            if (this.GeometryType == GeometryType.Polygon)
            {
                this.PhysicsVertices = new Vertices(gddModel.Vertices.Select(v => new Vector2(v.X, v.Y)).ToArray());
                this.physicsVertices.Rotate(-this.RollRotation);
                this.mass = gddModel.Mass * 100.0f;
            }

            this.LoadCommonContent();
            this.PhysicsBody.IsStatic = true;
        }