示例#1
0
        private int step, stepSize; // values for stepping

        #endregion Fields

        #region Constructors

        // constructors
        /// <summary>
        /// Object that places and orients itself.
        /// </summary>
        /// <param name="theStage"> the stage containing object </param> 
        /// <param name="aModel">how the object looks</param> 
        /// <param name="label"> name of object </param> 
        /// <param name="position"> position in stage </param> 
        /// <param name="orientAxis"> axis to orient on </param> 
        /// <param name="radians"> orientation rotation </param> 
        public Object3D(Stage theStage, Model3D aModel, string label, Vector3 position, 
      Vector3 orientAxis, float radians)
        {
            scales = Vector3.One;
              stage = theStage;
              model = aModel;
              name = label;
              step = 1;
              stepSize = 48;
              pitch = yaw = roll = 0.0f;
              orientation = Matrix.Identity;
              orientation *= Matrix.CreateFromAxisAngle(orientAxis, radians);
              orientation *= Matrix.CreateTranslation(position);
              scaleObjectBoundingSphere();
        }
示例#2
0
        // Overridden Game class methods.
        /// <summary>
        /// Set GraphicDevice display and rendering BasicEffect effect.  
        /// Create SpriteBatch, font, and font positions.
        /// Creates the traceViewport to display information and the sceneViewport
        /// to render the environment.
        /// Create and add all DrawableGameComponents and Cameras.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();  // create the Scene entities -- Inspector.

            // create a temple
            Model3D m3d = new Model3D(this, "temple", "templeV3");
            m3d.IsCollidable = true;  // must be set before addObject(...) and Model3D doesn't set it
            m3d.addObject(new Vector3(340 * spacing, terrain.surfaceHeight(340, 340), 340 * spacing), new Vector3(0, 1, 0), 0.79f);
            Components.Add(m3d);

            // create walls for obstacle avoidance or path finding algorithms
            Wall wall = new Wall(this, "wall", "100x100x100Brick");
            Components.Add(wall);

            // create a Pack of dogs
            //Pack pack = new Pack(this, "dog", "dogV3");
            //Components.Add(pack);
            Random random = new Random();

            nextCamera();  // select the first camera
        }