Adding Targets

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Adding_targets.php

Not much work is needed for this tutorial to work in the newest version of XNA!

All we need to do is change the technique that is used to draw the targets to the new one we wrote which accepts normal data and fix a couple of typos.

So in the DrawTargets() method change this line

currentEffect.CurrentTechnique = currentEffect.Techniques[“Colored”];

to this:

currentEffect.CurrentTechnique = currentEffect.Techniques[“ColoredNormal”];

If you didn’t cheat and were following the tutorial rather than copying the code from the bottom of the pages then you will also need to change a few more lines since the tutorial code contains some typos which have been fixed in the full code at the bottom of the page so:

targetTransforms.CopyAbsoluteBoneTransformsTo(targetTransforms);

should be:

targetModel.CopyAbsoluteTransformsTo(targetTransforms);

and change the line:

currentEffect.Parameters[“xWorld”].SetValue(xwingTransforms[modmesh.ParentBone.Index] * worldMatrix);

which should be:
currentEffect.Parameters[“xWorld”].SetValue(targetTransforms[modmesh.ParentBone.Index] * worldMatrix);

That’s it for this tutorial, next step “Point sprites” in inverted commas because were going to do something completely different!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s