Jump to content
  • Advertisement
Sign in to follow this  

Where is mine model? i am not seeing it

This topic is 2687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Avtar
/// <summary>
/// This is the main type for your game
/// </summary>
public class Game1 : Microsoft.Xna.Framework.Game
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Model sphere;
Matrix world=Matrix.Identity;
SpriteFont sf;
int curx;
public Game1()
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";


/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
// TODO: Add your initialization logic here


/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void Update(GameTime gameTime)
KeyboardState gc = Keyboard.GetState();
if (gc.IsKeyDown(Keys.A)) {
world = calculateA();

protected override void LoadContent()
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
sphere = this.Content.Load<Model>("tiger");
// TODO: use this.Content to load your game content here
sf = this.Content.Load<SpriteFont>("SpriteFont1");


/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// all content.
/// </summary>
protected override void UnloadContent()
// TODO: Unload any non ContentManager content here

/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>

/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
spriteBatch.DrawString(sf, world.ToString(), new Vector2(0, 0), Color.White);
Matrix mi = Matrix.CreateLookAt(new Vector3(-10, 0, 0), Vector3.Zero, Vector3.Up);

// TODO: Add your initialization code here

Matrix identity = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), GraphicsDevice.DisplayMode.AspectRatio, 0.1f, 100.0f);
foreach (ModelMesh mis in sphere.Meshes)

foreach (BasicEffect bs in mis.Effects)

bs.World = world;
bs.View = mi;
bs.Projection = identity;
foreach (EffectPass pass in bs.CurrentTechnique.Passes)


// TODO: Add your drawing code here


public Matrix calculateA()
Vector3 x = new Vector3(1,0,0);

//Up Vector
Vector3 y = new Vector3(0,1,0);
Vector3 z = Vector3.Cross(x, y);

Matrix YRot = new Matrix();
YRot.Right = x;
YRot.Up = y;
YRot.Backward = z;
return Matrix.Identity * YRot;



i am unable to see mine tiger on the screen whats the problem in it , am i creating the orientation matrix properly.. ,

am i using this perfectly

z=cros(x,y) is this logic correct please help me :P please tell me how do i create mine world matrix if i have to move from one postion to another in same direction ,is this method correct , sorry ,this is mine first post

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!