<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Nerd Herder</title><link>http://blogs.msdn.com/dejohn/default.aspx</link><description>Dean Johnson’s blog about life on the XNA platform and tools team</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Custom Avatar Animations PLUS 21 New Animations</title><link>http://blogs.msdn.com/dejohn/archive/2009/07/20/custom-avatar-animations-plus-21-new-animations.aspx</link><pubDate>Mon, 20 Jul 2009 23:15:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9842239</guid><dc:creator>dejohn</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9842239.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9842239</wfw:commentRss><description>&lt;p&gt;We have just posted three new avatar items to the XNA Creators Club Online site. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Custom Avatar Animation Sample     &lt;br /&gt;&lt;/strong&gt;This sample shows users how to import and play custom avatar animations though the content pipeline. &lt;a href="http://creators.xna.com/en-US/sample/customavataranimation"&gt;http://creators.xna.com/en-US/sample/customavataranimation&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Avatar Animation Rig&lt;/strong&gt;    &lt;br /&gt;We have provided both an Softimage Mod Tool 7.5 version and Maya 2008 version of the animation rig that can be used to create custom animations. &lt;a href="http://creators.xna.com/en-US/utility/avataranimationrig"&gt;http://creators.xna.com/en-US/utility/avataranimationrig&lt;/a&gt; Please take a look at the “readme” to understand how to load and export animations.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Avatar Animation Pack&lt;/strong&gt;    &lt;br /&gt;This pack contains 21 new animations that users can use in their games. We provided them in FBX format for direct use in your games or in source format for both Softimage Mod Tool 7.5 and Maya 2008. &lt;a href="http://creators.xna.com/en-US/utility/avataranimationpack"&gt;http://creators.xna.com/en-US/utility/avataranimationpack&lt;/a&gt; Please take a look at the “readme” to understand how to load and export animations.&lt;/p&gt;  &lt;p&gt;Enjoy&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9842239" width="1" height="1"&gt;</description></item><item><title>Simple example on how to load a signed in gamers avatar</title><link>http://blogs.msdn.com/dejohn/archive/2009/06/24/simple-example-on-how-to-load-a-sign-in-gamers-avatar.aspx</link><pubDate>Wed, 24 Jun 2009 23:27:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9802038</guid><dc:creator>dejohn</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9802038.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9802038</wfw:commentRss><description>&lt;p&gt;Now that XNA Game Studio 3.1 has been released I have had time to notice the types of questions people are asking on the forums about avatars. One question that has come up a few times is how to load a signed in gamers avatar. There are a couple of pitfalls. One thing that can be confusing to developers is that a SignedInGamer from the Gamer.SignedInGamers collection may be null for the first few frames when the game loads. So when a developer tries to read the Avatar property of a signed in gamer they will receive a null reference exception. The developer needs to wait until the gamer is recognized as being signed in and then attempt to load the players avatar. You game should not just check for the signed in gamer in a tight loop. Your game should go about doing other things like updating input and rendering. Games also need to handle the case where the signed in gamer doesn't have an avatar.&lt;/p&gt;  &lt;p&gt;There are a few ways to wait for the SignedInGamer to not be null and load the appropriate avatar. I will show a couple of methods. The first just polls and checks to see if the signed in gamer is not null and when it is not it loads the players avatar. If the player doesn't have an avatar a random one is created. Also if the system takes longer than 3 seconds for the gamer to sign then the code will load a random one instead. Below is an example of the first method.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; SimpleAvatarGame : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;

    AvatarDescription avatarDescription;
    AvatarRenderer avatarRenderer;
    AvatarAnimation avatarAnimation;

    &lt;span class="kwrd"&gt;public&lt;/span&gt; SimpleAvatarGame()
    {
        graphics = &lt;span class="kwrd"&gt;new&lt;/span&gt; GraphicsDeviceManager(&lt;span class="kwrd"&gt;this&lt;/span&gt;);
        Content.RootDirectory = &lt;span class="str"&gt;&amp;quot;Content&amp;quot;&lt;/span&gt;;

        graphics.PreferMultiSampling = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
        graphics.PreferredBackBufferWidth = 1280;
        graphics.PreferredBackBufferHeight = 720;

        Components.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; GamerServicesComponent(&lt;span class="kwrd"&gt;this&lt;/span&gt;)); 
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LoadContent()
    {
        avatarAnimation = &lt;span class="kwrd"&gt;new&lt;/span&gt; AvatarAnimation(AvatarAnimationPreset.Celebrate);
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Update(GameTime gameTime)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            &lt;span class="kwrd"&gt;this&lt;/span&gt;.Exit();

        LoadUserAvatar(gameTime);

        &lt;span class="rem"&gt;// You may want to check that the avatar renderer has loaded&lt;/span&gt;
        &lt;span class="rem"&gt;// so that the animation does not start playing until it has loaded&lt;/span&gt;
        avatarAnimation.Update(gameTime.ElapsedGameTime, &lt;span class="kwrd"&gt;true&lt;/span&gt;);

        &lt;span class="kwrd"&gt;base&lt;/span&gt;.Update(gameTime);
    }

    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
    &lt;span class="rem"&gt;/// Load player one's avatar&lt;/span&gt;
    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LoadUserAvatar(GameTime gameTime)
    {
        &lt;span class="rem"&gt;// Avatar may already be loaded&lt;/span&gt;
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (avatarRenderer != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
            &lt;span class="kwrd"&gt;return&lt;/span&gt;;

        &lt;span class="rem"&gt;// Check to see if the user is signed in&lt;/span&gt;
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (Gamer.SignedInGamers[PlayerIndex.One] != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            &lt;span class="rem"&gt;// Get the users avatar description&lt;/span&gt;
            avatarDescription = Gamer.SignedInGamers[PlayerIndex.One].Avatar;

            &lt;span class="rem"&gt;// If this is not valid the user doen't have an avatar&lt;/span&gt;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!avatarDescription.IsValid)
            {
                avatarDescription = AvatarDescription.CreateRandom();
            }

            avatarRenderer = &lt;span class="kwrd"&gt;new&lt;/span&gt; AvatarRenderer(avatarDescription);
        }
        &lt;span class="rem"&gt;// Check to see if it has been longer than 3 seconds&lt;/span&gt;
        &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (gameTime.TotalGameTime.TotalSeconds &amp;gt; 3)
        {
            avatarDescription = AvatarDescription.CreateRandom();
            avatarRenderer = &lt;span class="kwrd"&gt;new&lt;/span&gt; AvatarRenderer(avatarDescription);
        }
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        &lt;span class="kwrd"&gt;if&lt;/span&gt; (avatarRenderer != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            avatarRenderer.World = Matrix.CreateRotationY(MathHelper.ToRadians(180.0f));
            avatarRenderer.View = Matrix.CreateLookAt(&lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 1, 3), &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 1, 0), Vector3.Up);&lt;br /&gt;            avatarRenderer.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), &lt;br /&gt;                                                     GraphicsDevice.Viewport.AspectRatio, .01f, 200.0f); 
            avatarRenderer.Draw(avatarAnimation.BoneTransforms, avatarAnimation.Expression);
        }

        &lt;span class="kwrd"&gt;base&lt;/span&gt;.Draw(gameTime);
    }
}&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;/pre&gt;

&lt;p&gt;Another technique for determining when the gamer has signed in and to read their Avatar property is to subscribe to the SignedInGamer.SignedIn event handler. Below is an example how to do this.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; SimpleAvatarGame : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;

    AvatarDescription avatarDescription;
    AvatarRenderer avatarRenderer;
    AvatarAnimation avatarAnimation;

    &lt;span class="kwrd"&gt;public&lt;/span&gt; SimpleAvatarGame()
    {
        graphics = &lt;span class="kwrd"&gt;new&lt;/span&gt; GraphicsDeviceManager(&lt;span class="kwrd"&gt;this&lt;/span&gt;);
        Content.RootDirectory = &lt;span class="str"&gt;&amp;quot;Content&amp;quot;&lt;/span&gt;;

        graphics.PreferMultiSampling = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
        graphics.PreferredBackBufferWidth = 1280;
        graphics.PreferredBackBufferHeight = 720;

        Components.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; GamerServicesComponent(&lt;span class="kwrd"&gt;this&lt;/span&gt;));

        SignedInGamer.SignedIn += &lt;span class="kwrd"&gt;new&lt;/span&gt; EventHandler&amp;lt;SignedInEventArgs&amp;gt;(LoadGamerAvatar); 
    }

    &lt;span class="kwrd"&gt;void&lt;/span&gt; LoadGamerAvatar(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, SignedInEventArgs e)
    {
        avatarDescription = e.Gamer.Avatar;

        &lt;span class="rem"&gt;// Check to see if the player has an avatar&lt;/span&gt;
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (!avatarDescription.IsValid)
        {
            avatarDescription = AvatarDescription.CreateRandom();
        }

        avatarRenderer = &lt;span class="kwrd"&gt;new&lt;/span&gt; AvatarRenderer(avatarDescription);
    } 

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LoadContent()
    {
        avatarAnimation = &lt;span class="kwrd"&gt;new&lt;/span&gt; AvatarAnimation(AvatarAnimationPreset.Celebrate);
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Update(GameTime gameTime)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            &lt;span class="kwrd"&gt;this&lt;/span&gt;.Exit();

        &lt;span class="rem"&gt;// You may want to check that the avatar renderer has loaded&lt;/span&gt;
        &lt;span class="rem"&gt;// so that the animation does not start playing until it has loaded&lt;/span&gt;
        avatarAnimation.Update(gameTime.ElapsedGameTime, &lt;span class="kwrd"&gt;true&lt;/span&gt;);

        &lt;span class="kwrd"&gt;base&lt;/span&gt;.Update(gameTime);
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        &lt;span class="kwrd"&gt;if&lt;/span&gt; (avatarRenderer != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            avatarRenderer.World = Matrix.CreateRotationY(MathHelper.ToRadians(180.0f));&lt;br /&gt;            avatarRenderer.View = Matrix.CreateLookAt(&lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 1, 3), &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 1, 0), Vector3.Up);
            avatarRenderer.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), &lt;br /&gt;                                                     GraphicsDevice.Viewport.AspectRatio, .01f, 200.0f);
            avatarRenderer.Draw(avatarAnimation.BoneTransforms, avatarAnimation.Expression);
        }

        &lt;span class="kwrd"&gt;base&lt;/span&gt;.Draw(gameTime);
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;If you have any questions please ask on the forums here &lt;a href="http://forums.xna.com"&gt;http://forums.xna.com&lt;/a&gt;.&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9802038" width="1" height="1"&gt;</description></item><item><title>AvatarDescription.Description</title><link>http://blogs.msdn.com/dejohn/archive/2009/05/28/avatardescription-description.aspx</link><pubDate>Thu, 28 May 2009 21:54:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9648489</guid><dc:creator>dejohn</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9648489.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9648489</wfw:commentRss><description>&lt;p&gt;In a couple of previous posts &lt;a href="http://blogs.msdn.com/dejohn/archive/2009/05/08/avatar-api-preview-for-xna-game-studio-3-1.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/dejohn/archive/2009/05/20/avatardescription-isvalid-when-why-the-description-returned-is-invalid.aspx"&gt;here&lt;/a&gt; I talked about the AvatarDescription.Description property that returns a byte[].&lt;/p&gt;  &lt;p&gt;The AvatarDescription.Description property is provided to allow developers to recreate a previously created AvatarDescription object. The byte[] from the property is used in conjunction with the AvatarDescription(byte[] ) constructor to recreate the description object.&lt;/p&gt;  &lt;p&gt;There are three main scenarios this enables. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Avatars in online games&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;When a player joins an online game their game sends their AvatarDescription.Description to all of the other players in the session. Each of the other players can then create the AvatarDescription object using the AvatarDescription(byte[] ) constructor. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Saving a players random avatar choice&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You may want to allow a player to select some of the characters in their game. For example a user may pick party members in an RPG. The developer can continue to generate random AvatarDescription objects by calling AvatarDescription.CreateRandom(). The developer can then save the AvatarDescription.Description for the random avatars the player as selected along with other save game data. The data can then be read when the player loads the game so that they see the same characters they had in a previous game.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Loading a avatar designed by the developer&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The final scenario allows the developer to design a specific avatar for use as a character in their game. This can be done by creating the desired look for the avatar in the Xbox 360 dash avatar editor. Then use an Xbox 360 XNA Game Studio game to load the AvatarDescription object from the SignedInGamer.Avatar property for the profile associated with the avatar you want to use. Put a breakpoint somewhere in your code after loading the AvatarDescription. Debug the code and put the AvatarDescription object you created in the watch window in Visual Studio. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/AvatarDescription.Description_A760/clip_image002_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/AvatarDescription.Description_A760/clip_image002_thumb.jpg" width="591" height="366" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next you will need to copy the contents of the Description property and format the text. You can then use these values to construct a new byte[] that can be used to create the AvatarDescription in your game. You can either hard code this byte[] in your source code or save it to a file and create a content processor.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9648489" width="1" height="1"&gt;</description></item><item><title>AvatarDescription.IsValid… When &amp; Why the description returned is invalid?</title><link>http://blogs.msdn.com/dejohn/archive/2009/05/20/avatardescription-isvalid-when-why-the-description-returned-is-invalid.aspx</link><pubDate>Wed, 20 May 2009 23:51:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9632864</guid><dc:creator>dejohn</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9632864.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9632864</wfw:commentRss><description>&lt;p&gt;In previous posts I talked about how the AvatarDescription contains data to define what an avatar should look like so that the AvatarRenderer knows what assets to load in order to render the avatar. The AvatarDescription type contains a property called IsValid which is a read only bool. So what does this property tell the developer? It tells the developer if the description is valid of course! So when can a developer expect a description to be valid and invalid?&lt;/p&gt;  &lt;p&gt;First let’s go over the different ways a user can create an AvatarDescription object. &lt;/p&gt;  &lt;p&gt;Gamer.SignedInGamers[PlayerIndex.One].Avatar – Returns the avatar description from a gamers profile.&lt;/p&gt;  &lt;p&gt;AvatarDescription.CreateRandom() – Returns a randomly created avatar description.&lt;/p&gt;  &lt;p&gt;AvatarDescription(byte[] data) – Constructor that allows the developer to construct a description from a byte[] that was returned from the AvatarDescription.Description property of an already created AvatarDescription object. A future post will talk more about this constructor and why it is useful.&lt;/p&gt;  &lt;p&gt;Now for the rules on when descriptions are valid vs. invalid.&lt;/p&gt;  &lt;p&gt;· On Windows the profile and random avatar descriptions will return as invalid descriptions because Windows does not support avatars.&lt;/p&gt;  &lt;p&gt;· On Xbox the random avatar description will return valid descriptions.&lt;/p&gt;  &lt;p&gt;· On Xbox the profile avatar description can return both valid and invalid descriptions. If a user does not have an avatar associated with their profile then the avatar description returned will be invalid.&lt;/p&gt;  &lt;p&gt;Not too confusing right?&lt;/p&gt;  &lt;p&gt;So how do invalid AvatarDescriptions behave? &lt;/p&gt;  &lt;p&gt;The properties on the AvatarDescription such as the Height, BodyType, and Description return default values. IsValid returns false as you would expect.&lt;/p&gt;  &lt;p&gt;So what happens if you use an invalid AvatarDescription to create an AvatarRenderer? Does it throw an exception? No. You will get back an AvatarRenderer object. You can do everything that you would do normally with an AvatarRenderer created with a valid AvatarDescription. The difference is when you call draw nothing will be displayed to the screen. This was done so that while you develop your game on Windows you will not need to wrap all of your AvatarRenderer constructor or draw calls in try/catch statements. While the avatar will not draw on Windows there is also a chance that the users profile on the Xbox will also be invalid. The developer should detect that the game can’t display an avatar and do something appropriate. For example the developer may create a stand in model to use when a user doesn’t have a valid avatar description.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9632864" width="1" height="1"&gt;</description></item><item><title>Lights, Camera… Avatar!</title><link>http://blogs.msdn.com/dejohn/archive/2009/05/18/lights-camera-avatar.aspx</link><pubDate>Tue, 19 May 2009 00:57:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9626187</guid><dc:creator>dejohn</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9626187.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9626187</wfw:commentRss><description>&lt;p&gt;Sometimes you may not want your avatar flawlessly lit from above. What if your game takes place at night? What if the sun in your game is green? What if you need the light to move?&lt;/p&gt;  &lt;p&gt;The Avatar APIs expose an ambient light and one directional light. The AvatarRenderer class has properties for AmbientLightColor, LightDirection, and LightColor. All are of the type Vector3. &lt;/p&gt;  &lt;p&gt;The APIs also allow the developer to over saturate these values. This allows for some cool lighting effects like the one pictured below. I used the following code to product the results below.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;avatarRenderer.LightDirection = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(1, 1, 0);
avatarRenderer.LightColor = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 10, 0);
avatarRenderer.AmbientLightColor = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(1, 0, 0); &lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/LightsCameraAvatar_D242/clip_image002_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/LightsCameraAvatar_D242/clip_image002_thumb.jpg" width="497" height="423" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So what happens if you set all of the values to zero? You should get a completely black area in the shape of your avatar correct? &lt;/p&gt;

&lt;pre class="csharpcode"&gt;avatarRenderer.LightDirection = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 0, 0);
avatarRenderer.LightColor = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 0, 0);
avatarRenderer.AmbientLightColor = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 0, 0); &lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/LightsCameraAvatar_D242/clip_image004_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/LightsCameraAvatar_D242/clip_image004_thumb.jpg" width="498" height="517" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dark but not totally black. The avatar system uses a rim light also called a back light to create an edge around the avatar. But it is still possible to make the avatar completely black. Just set the ambient values all to a negative number. This will subtract from the final lighting values. &lt;/p&gt;

&lt;pre class="csharpcode"&gt;avatarRenderer.LightDirection = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 0, 0);
avatarRenderer.LightColor = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 0, 0);
avatarRenderer.AmbientLightColor = &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(-1, -1, -1);&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/LightsCameraAvatar_D242/clip_image006_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/LightsCameraAvatar_D242/clip_image006_thumb.jpg" width="489" height="613" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see from the picture above there is still a small amount of light on the avatars shoes. This can be removed with a larger negative number for the ambient light value.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9626187" width="1" height="1"&gt;</description></item><item><title>Avatar animation updates</title><link>http://blogs.msdn.com/dejohn/archive/2009/05/14/avatar-animation-updates.aspx</link><pubDate>Thu, 14 May 2009 22:40:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9616941</guid><dc:creator>dejohn</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9616941.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9616941</wfw:commentRss><description>&lt;p&gt;Playback of one of the 31 built in animations is simple with the AvatarAnimation class. As I discussed in a previous &lt;a href="http://blogs.msdn.com/dejohn/archive/2009/05/08/avatar-api-preview-for-xna-game-studio-3-1.aspx"&gt;post&lt;/a&gt; the BoneTransforms and Expression properties on the AvatarAnimation can be used with the AvatarRenderer.Draw method to animate an avatar. These two properties return the bone transforms and expression at a time in the animation based on the CurrentPosition property. CurrentPosition is a TimeSpan value that represents where in the animation playback is currently located. Valid values for CurrentPosition can be from zero to AvatarAnimation.Length. &lt;/p&gt;  &lt;p&gt;There are two ways to set the CurrentPosition. The first and indirect way is to use the AvatarAnimation.Update(TimeSpan elapsedAnimationTime, bool loop) method that was used in the previous post. This allows the developer to specify the amount of time that has passed since the last update call. This delta can be provided by the gameTime.ElapsedGameTime parameter in the Game.Update method. It also allows the developer to specify if they want the animation to loop or not. The developer can also specify a negative elapsedAnimationTime value to play the animation backwards. &lt;/p&gt;  &lt;p&gt;The other way is to use the CurrentPosition property directly. This allows the developer to implement any type of playback that they wish. While this is flexible it leaves managing looping and bounds checking to the developer. &lt;/p&gt;  &lt;p&gt;Most developers will most likely use the Update method but the CurrentPosition property is exposed to allow for greater animation playback flexibility.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9616941" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dejohn/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Avatar/default.aspx">Avatar</category></item><item><title>A few design changes</title><link>http://blogs.msdn.com/dejohn/archive/2009/05/12/a-few-design-changes.aspx</link><pubDate>Wed, 13 May 2009 01:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9608328</guid><dc:creator>dejohn</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9608328.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9608328</wfw:commentRss><description>&lt;P&gt;I made a few layout changes to the blog today to allow for more room for the text on the site and more specifically the code samples. If the code blocks or images are too wide please comment and let me know. I went back and updated a couple of my last posts to make the code more readable now there is more space.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9608328" width="1" height="1"&gt;</description></item><item><title>What to do while an avatar loads?</title><link>http://blogs.msdn.com/dejohn/archive/2009/05/11/what-to-do-while-an-avatar-loads.aspx</link><pubDate>Mon, 11 May 2009 21:08:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9603838</guid><dc:creator>dejohn</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9603838.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9603838</wfw:commentRss><description>&lt;p&gt;When you create a new AvatarRenderer object load all of the models and textures associated with the AvatarDescription have to be loaded. The time it takes to load goes up if you are creating a number of AvatarRenderer objects at the same time.&lt;/p&gt;  &lt;p&gt;So what do developers need to do while the avatar loads? &lt;/p&gt;  &lt;p&gt;In most cases nothing! Just call the avatar draw method as if the avatar was already loaded. By default we will draw a loading effect in place of the avatar while it loads. Once the avatar has completed loading the loading effect will fade out to reveal the avatar.&lt;/p&gt;  &lt;p&gt;If you want to determine if the avatar has loaded fully you can use the AvatarRenderer.IsLoaded property. &lt;/p&gt;  &lt;p&gt;If you don&amp;#8217;t want to use the loading effect you can use the AvatarRenderer constructor overload below.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;AvatarRenderer(AvatarDescription avatarDescription, &lt;span class="kwrd"&gt;bool&lt;/span&gt; useLoadingEffect);&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;So what does this loading effect look like? The loading effect is made up of a number of transparent quads that display an animating texture.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/Whattodowhileanavatarloads_9CBE/clip_image001_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="clip_image001" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/Whattodowhileanavatarloads_9CBE/clip_image001_thumb.jpg" width="763" height="430" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9603838" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dejohn/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Avatar/default.aspx">Avatar</category></item><item><title>Avatar API preview for XNA Game Studio 3.1</title><link>http://blogs.msdn.com/dejohn/archive/2009/05/08/avatar-api-preview-for-xna-game-studio-3-1.aspx</link><pubDate>Sat, 09 May 2009 01:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9597931</guid><dc:creator>dejohn</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/9597931.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=9597931</wfw:commentRss><description>&lt;p&gt;Since the announcement of the 3.1 features a number of people have had questions about the new Avatar API&amp;#8217;s. I wanted to take a few minutes to preview some of Avatar API&amp;#8217;s to help developers better understand what to expect in the 3.1 release.&lt;/p&gt;  &lt;p&gt;There are three main classes that are used to render and animate an avatar. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;AvatarDescription      &lt;br /&gt;&lt;/strong&gt;Each avatar has a description that describes how the avatar looks and what clothing the avatar has on. This description tells the system what models, textures, colors, and scales to use when rendering an avatar. This description is mostly opaque to the developer but does allow for the developer to get the height and body type of the avatar. The height is in meters and the body type allows the developer to know if the avatar is female or male. The AvatarDescription object can be created in three ways. The first way is to read the Avatar property on any of the SingedInGamers. The second is to use the static methods on AvatarDescription to create random descriptions. The third is to send an AvatarDescription over the network or save it to a file by looking up a byte array from the AvatarDescription, transferring those bytes, and then creating a new AvatarDescription from the byte array. I will create a future post to talk more about the third method.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;AvatarRenderer      &lt;br /&gt;&lt;/strong&gt;The AvatarRenderer is used to draw an avatar to the screen. You create a new AvatarRenderer by passing in an AvatarDescription object. To draw the avatar to the screen you set the World, View, and Projection matrix properties on the AvatarRenderer object and then call the Draw method. The draw method takes two parameters. The first is an IList&amp;lt;Matrix&amp;gt; called bones. This is a list of the bone transforms to use when rendering the avatar. The transforms are in local bone space relative to their parent. The avatar has a total of 71 bones. The second parameter is an AvatarExpression. Avatars use textures for the mouth, eyes, and eyebrows. The AvatarExpression is a structure that holds enum values that specify the current state of the eyes, eyebrows, and mouth. Now you may be asking where you get the list of bone matrices and the avatar expression. The easiest way is to use the AvatarAnimaion class.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;AvatarAnimation      &lt;br /&gt;&lt;/strong&gt;There are 31 built in animations that developers can use in their games. Most of these animations are used in the dash. An AvatarAnimation object is created by passing an enum value from AvatarAnimationPreset. Once created the developer updates the animations current time. After setting the current time in the animation the developer can access the bones and expression needed by the AvatarRednerer.Draw call by using the BoneTransforms and Expression properties.&lt;/p&gt;  &lt;p&gt;Now let&amp;#8217;s check out how to code this up.&lt;/p&gt;  &lt;p&gt;In the games initialize method load the description, renderer, and animation.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;AvatarDescription avatarDescription = AvatarDescription.CreateRandom();
AvatarRenderer avatarRenderer = &lt;span class="kwrd"&gt;new&lt;/span&gt; AvatarRenderer(avatarDescription);
AvatarAnimation avatarAnimation = &lt;span class="kwrd"&gt;new&lt;/span&gt; AvatarAnimation(AvatarAnimationPreset.Clap);&lt;/pre&gt;

&lt;p&gt;Now in the games update method update the animation.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;avatarAnimation.Update(gameTime.ElapsedGameTime, &lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Finally in the draw method set the world, view, and projection matrix and call the draw method.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;avatarRenderer.World = Matrix.CreateRotationY(MathHelper.ToRadians(180.0f));
avatarRenderer.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),&lt;br /&gt;                                                        GraphicsDevice.Viewport.AspectRatio, &lt;br /&gt;                                                        .01f, 200.0f);
avatarRenderer.View = Matrix.CreateLookAt(&lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 1, 3), &lt;br /&gt;                                          &lt;span class="kwrd"&gt;new&lt;/span&gt; Vector3(0, 1, 0), &lt;br /&gt;                                          Vector3.Up);

avatarRenderer.Draw(avatarAnimation.BoneTransforms, avatarAnimation.Expression);&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;All this talk about how to render an avatar without a picture would be wrong. So below is one of the first screen shots taken while working on this feature.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/AvatarAPIpreviewforXNAGameStudio3.1_D765/clip_image001_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/AvatarAPIpreviewforXNAGameStudio3.1_D765/clip_image001_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="clip_image001" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/AvatarAPIpreviewforXNAGameStudio3.1_D765/clip_image001_thumb.jpg" width="632" height="358" mce_src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/AvatarAPIpreviewforXNAGameStudio3.1_D765/clip_image001_thumb.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9597931" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dejohn/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Avatar/default.aspx">Avatar</category></item><item><title>How to set the effect (.fx) used on Model</title><link>http://blogs.msdn.com/dejohn/archive/2008/06/01/how-to-set-the-effect-fx-used-on-model.aspx</link><pubDate>Mon, 02 Jun 2008 00:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8568309</guid><dc:creator>dejohn</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/8568309.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=8568309</wfw:commentRss><description>&lt;P&gt;When you use the model processor build into the XNA Framework Content Pipeline you will notice that each ModelMeshPart on a Model has an Effect already loaded. By default this is an instance of BasicEffect with the models textures and other material properties already set. This is great when you want to get a model loaded and rendering quick but sometimes you want to set a custom effect that you have previously created. &lt;/P&gt;
&lt;P&gt;To help show users how to load a custom effect file on a model we created a sample called Custom Model Effect found &lt;A href="http://creators.xna.com/en-us/sample/custommodeleffect" target=_blank mce_href="http://creators.xna.com/en-us/sample/custommodeleffect"&gt;here&lt;/A&gt;. The sample sets the new effect file in a custom content processor before saving the model out into an .xnb file. In this post I hope to show how to can extend this idea to allow you to create a custom processor that will accept a processor parameter for the effect file. This will allow you to reuse the same processor for many of your models even if they use separate effect files.&lt;/P&gt;
&lt;P&gt;The first step is to create a new Content Pipeline Extension Library project if you do not already have one setup for your project. You will also need to setup a reference to the new project in your content project. The &lt;A href="http://msdn.microsoft.com/en-us/library/bb447754.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/bb447754.aspx"&gt;XNA Docs&lt;/A&gt; have some great resources that show you how to do this.&lt;/P&gt;
&lt;P&gt;Next you will need to overwrite the standard model processor. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ContentProcessor] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class CustomEffectModelProcessor : ModelProcessor&lt;/P&gt;
&lt;P&gt;Your new class needs a processor parameter that will take in your new effect file name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DisplayName("Custom Effect")] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DefaultValue("")] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Description("The custom effect applied to the model.")] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string CustomEffect &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return customEffect; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { customEffect = value; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private string customEffect;&lt;/P&gt;
&lt;P&gt;You will need to add a using statement for System.ComponentModel for the new parameter.&lt;/P&gt;
&lt;P&gt;Next you will need to override the ConvertMaterial method of the standard model processor so we can call our new material processor. Also notice that we pass along the processor parameter we defined above.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;protected override MaterialContent ConvertMaterial(MaterialContent material, ContentProcessorContext context) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OpaqueDataDictionary processorParameters = new OpaqueDataDictionar(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; processorParameters.Add("CustomEffect", customEffect); &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return context.Convert&amp;lt;MaterialContent, MaterialContent&amp;gt;(material, "CustomEffectMaterialProcessor", processorParameters); &lt;BR&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now our new model processor will be looking for a material processor called "CustomEffectMaterialProcessor". The next step is to create this new material processor.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;[ContentProcessor] &lt;BR&gt;class CustomEffectMaterialProcessor : MaterialProcessor&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Our material processor needs two parts. The first is the same processor parameter as we created above for the model processor to accept the filename of the custom effect file. The other is an override of the Process method.&lt;/P&gt;
&lt;P&gt;public override MaterialContent Process(MaterialContent input, ContentProcessorContext context)&lt;/P&gt;
&lt;P&gt;In the process method we need to create the new EffectMaterialContent and load the custom effect from the file.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;// Create a new effect material. &lt;BR&gt;EffectMaterialContent customMaterial = new EffectMaterialContent(); &lt;/P&gt;
&lt;P&gt;// Point the new material at the custom effect file. &lt;BR&gt;string effectFile = Path.GetFullPath(customEffect); &lt;BR&gt;customMaterial.Effect = new ExternalReference&amp;lt;EffectContent&amp;gt;(effectFile); &lt;/P&gt;
&lt;P&gt;// Loop over the textures in the current material adding them to the new material. &lt;BR&gt;foreach (KeyValuePair&amp;lt;string, ExternalReference&amp;lt;TextureContent&amp;gt;&amp;gt; textureContent in input.Textures) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; customMaterial.Textures.Add(textureContent.Key, textureContent.Value); &lt;BR&gt;} &lt;/P&gt;
&lt;P&gt;// Loop over the opaque data in the current material adding them to the new material. &lt;BR&gt;foreach (KeyValuePair&amp;lt;string, Object&amp;gt; opaqueData in input.OpaqueData) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; customMaterial.OpaqueData.Add(opaqueData.Key, opaqueData.Value); &lt;BR&gt;} &lt;/P&gt;
&lt;P&gt;// Call the base material processor to continue the rest of the processing. &lt;BR&gt;return base.Process(customMaterial, context);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now all you will need to do is set the Content Processor of your model to your new CustomEffectModelProcessor and set the Custom Effect to the effect file that you wish to use.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/Howtosettheeffect.fxusedonModel_CA92/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/Howtosettheeffect.fxusedonModel_CA92/image_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=311 alt=image src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/Howtosettheeffect.fxusedonModel_CA92/image_thumb.png" width=468 border=0 mce_src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/Howtosettheeffect.fxusedonModel_CA92/image_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8568309" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dejohn/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Content+Pipeline/default.aspx">Content Pipeline</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/HLSL/default.aspx">HLSL</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Effect/default.aspx">Effect</category></item><item><title>Community Games and the new Creators Club Online Website</title><link>http://blogs.msdn.com/dejohn/archive/2008/05/29/community-games-and-the-new-creators-club-online-website.aspx</link><pubDate>Thu, 29 May 2008 08:18:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8557294</guid><dc:creator>dejohn</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/8557294.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=8557294</wfw:commentRss><description>&lt;p&gt;It has been over a year since my last blog post. As one colleague put it I was starting to get &amp;#8220;Blogger Guilt&amp;#8221;. The last post was all about the new Creators Club Online website. Well it turns out this post is about the same topic but much better. The original site did a great job at delivering information and educational content to our users.&lt;/p&gt;  &lt;p&gt;The new site does that all a lot more. It is still home to the XNA forums and a bunch of great XNA educational content but it is also now home to the Community Games on Xbox LIVE Beta. Creators now have the ability to submit, peer review, and play community games. Go check out the new site at &lt;a href="http://creators.xna.com"&gt;http://creators.xna.com&lt;/a&gt; for more information.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/CommunityGamesandthenewCreatorsClubOnlin_139AD/clip_image002_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="355" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/CommunityGamesandthenewCreatorsClubOnlin_139AD/clip_image002_thumb.jpg" width="499" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8557294" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dejohn/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Creators+Club/default.aspx">Creators Club</category></item><item><title>XNA Creators Club Online</title><link>http://blogs.msdn.com/dejohn/archive/2007/03/05/xna-creators-club-online.aspx</link><pubDate>Tue, 06 Mar 2007 00:50:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1812405</guid><dc:creator>dejohn</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/1812405.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=1812405</wfw:commentRss><description>&lt;p&gt;The new XNA Creators Club Online site went live today.&amp;nbsp;You can view the site by visiting &lt;a href="http://creators.xna.com"&gt;http://creators.xna.com&lt;/a&gt;. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1812405" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dejohn/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Creators+Club/default.aspx">Creators Club</category></item><item><title>You Spin Me Round</title><link>http://blogs.msdn.com/dejohn/archive/2007/01/15/you-spin-me-round.aspx</link><pubDate>Tue, 16 Jan 2007 02:05:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1473267</guid><dc:creator>dejohn</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/dejohn/comments/1473267.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dejohn/commentrss.aspx?PostID=1473267</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;Often when working with 3D objects like characters and space ships you will need to point one object at the other. In this post we will cover two ways you can point objects at each other. The first way creates a matrix to turn your object towards the other. The second covers a way to determine the direction your object needs to turn.  &lt;p&gt;Before we start we will cover some vector operations or what they represent. So here are a couple of the operations we will be using.  &lt;p&gt;The vector cross product of X and Y creates a third vector Z that is orthogonal to both of them. Here are two resources for further information.  &lt;p&gt;&lt;a href="http://mathworld.wolfram.com/CrossProduct.html"&gt;http://mathworld.wolfram.com/CrossProduct.html&lt;/a&gt;  &lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Cross_product"&gt;http://en.wikipedia.org/wiki/Cross_product&lt;/a&gt;  &lt;p&gt;The vector dot product represents a couple of things. Geometrically it represents the projection of X onto the unit length vector of Y. So you get the length of the X vector in the Y direction. This will be very useful for us later.  &lt;p&gt;&lt;a href="http://mathworld.wolfram.com/DotProduct.html"&gt;http://mathworld.wolfram.com/DotProduct.html&lt;/a&gt;  &lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Dot_product"&gt;http://en.wikipedia.org/wiki/Dot_product&lt;/a&gt;  &lt;p&gt;In order to turn&amp;nbsp;the character towards another object (in this case, a sphere), we first create a vector between the two objects. Because we are in a right handed coordinate system we will be using –Z as our forward direction. To get the new forward vector of our object we need to take our position and subtract the position of the object. &lt;pre class="csharpcode"&gt;characterLocalMatrix.Forward = characterLocalMatrix.Translation &lt;br&gt;     - spherePosition;&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;Now we need to normalize the forward vector because we want our local matrix to be orthonormalized. If the object had been scaled this would be a good time to add the scale back to the object by multiplying the forward vector by the objects scale in the Z direction.&lt;pre class="csharpcode"&gt;characterLocalMatrix.Forward = Vector3.Normalize(&lt;br&gt;     characterLocalMatrix.Forward);&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;Next we need to create a new right vector for the object. To do this we are going to cross the new forward vector with the world up vector. We do this because we don’t yet know what the up vector is going to be so we will come back later and fix the up vector. Note that if your objects have abnormal orientations this will not work because it assumes that world up is close to your eventual up vector. The new right vector also needs to be normalized.&lt;pre class="csharpcode"&gt;characterLocalMatrix.Right = Vector3.Cross(characterLocalMatrix.Forward, &lt;br&gt;     Vector3.Up);
characterLocalMatrix.Right = Vector3.Normalize(characterLocalMatrix.Right);
&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;Finally we need to create our up vector by crossing the new right and forward vectors. &lt;pre class="csharpcode"&gt;characterLocalMatrix.Up = Vector3.Cross(characterLocalMatrix.Right, &lt;br&gt;     characterLocalMatrix.Forward);
characterLocalMatrix.Up = Vector3.Normalize(characterLocalMatrix.Up);&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;Our characters local matrix is now ready to use. If you are using the BasicEffect your draw code will look something like this.&lt;pre class="csharpcode"&gt;effect.World = characterLocalMatrix;
effect.View = viewMatrix;
effect.Projection = projectionMatrix;&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/YouSpinMeRound_C31D/CharacterVectors13.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="311" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/YouSpinMeRound_C31D/CharacterVectors_thumb9.jpg" width="495" border="0"&gt;&lt;/a&gt; 
&lt;p&gt;Now that you know how to turn directly towards another object, what happens when you want to know what direction your AI should turn in order to face you? We need a way to determine if it is better to turn left or right. We will use the dot product to determine if we should turn left or right. Like the last example the first thing we need to do is to create a vector to the target. We also want the vector to be unit length so we also normalize the vector.&lt;pre class="csharpcode"&gt;Vector3 turnAt = spherePosition - characterLocalMatrix.Translation;
turnAt.Normalize();&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;Next we calculate the dot product with our right vector. You might wonder why the right vector when we are trying to turn our forward vector. The reason is because of the behavior of the dot product. By using the right vector the result of the dot product with the turnAt vector will result in the projection of the turnAt vector in the right direction. This will get of the length of the turnAt in the right direction. If the result is positive it means we should turn left and if the result is negative we should turn right. 
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/YouSpinMeRound_C31D/DotVectors4.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="227" src="http://blogs.msdn.com/blogfiles/dejohn/WindowsLiveWriter/YouSpinMeRound_C31D/DotVectors_thumb.jpg" width="300" border="0"&gt;&lt;/a&gt; &lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;// Determine direction we need to turn using right vector&lt;/span&gt;
&lt;span class="kwrd"&gt;float&lt;/span&gt; dotResult = Vector3.Dot(turnAt, characterLocalMatrix.Right);
&lt;span class="rem"&gt;// Turn left&lt;/span&gt;
&lt;span class="kwrd"&gt;if&lt;/span&gt; (dotResult &amp;gt; 0.1f)
{
    characterLocalMatrix *= Matrix.CreateRotationY(turnSpeed * &lt;br&gt;        gameTime.ElapsedGameTime.Milliseconds);
}
&lt;span class="rem"&gt;// Turn right&lt;/span&gt;
&lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (dotResult &amp;lt; -0.1f)
{
    characterLocalMatrix *= Matrix.CreateRotationY(-turnSpeed * &lt;br&gt;        gameTime.ElapsedGameTime.Milliseconds);
}&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;You will notice that we don’t check dotResult with 0. This is because the character will turn past the object and then turn the other direction. This cycle will go back and forth causing the character to shake. So this technique uses a dead zone. Another option if to turn directly at the target when you get in this zone. 
&lt;p&gt;Well that’s the end of my first post. While the information here was geared towards people new to 3D graphics I hope it helped everyone.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1473267" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dejohn/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Math/default.aspx">Math</category><category domain="http://blogs.msdn.com/dejohn/archive/tags/Matrix/default.aspx">Matrix</category></item></channel></rss>