Model not showing up

Jan 21, 2013 at 1:35 PM
Edited Jan 21, 2013 at 4:03 PM

EDIT:
Fixed thanks to ChFlashER.



Hello,

I'm trying to add an Enemy with the model already defined, however it is not showing up.

var zombieModel = Content.Load<Microsoft.Xna.Framework.Graphics.Model>("Blocks/zombieblock");
enemies[0] = new Enemy(new Nine.Graphics.Model(zombieModel), new Vector3(270,0,0) , Vector3.Zero, 0f, 100);
scene.Add(enemies[0]); 


On the other hand, when I only add the model, it works. But then I don't have all the stuff declared in Enemy.cs.
scene.Add(zombieModel); works

When I stop debugging and look at values like distance between the Player object and the Enemy object, it shows that the enemy is actually there, but it isn't drawn in the scene.

How come scene.Add(enemies[0]); doesn't show the model in the scene? 

 

My Enemy.cs:

 

namespace NineQ
{
    class Enemy
    {
        public Nine.Graphics.Model Model { get; set; }
        public Vector3 Position { get; set; }
        public Vector3 Direction { get; set; }
        public float Speed { get; set; }
        public int Health = 100;

        public Enemy(Nine.Graphics.Model Model, Vector3 Position, Vector3 Direction, float Speed, int Health)
        {
            this.Model = Model;
            this.Position = Position;
            this.Direction = Direction;
            this.Speed = Speed;
            this.Health = Health;
        }

        public void Update(float elapsedTime)
        {
            var Player = Game1.scene.FindName<Nine.Graphics.Model>("mmm");
            Direction = Player.AbsoluteTransform.Translation;
            this.Position -= Direction * Speed * elapsedTime;
        }

    }
}



-Stefan 

Coordinator
Jan 21, 2013 at 11:10 PM
Edited Jan 22, 2013 at 2:12 AM
What is your Enemy class look like?