Drawing primitives with game components

For anyone drawing with primitives in their main draw class and a game components draw class make sure that you set the verticies and indicies on the graphics device in each draw class as the graphics device is shared:

graphics.GraphicsDevice.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionNormalTexture.SizeInBytes);

graphics.GraphicsDevice.Indices = indexBuffer;

otherwise you may be wondering why your objects are not being drawn how you intended.
Read more

Simple collision detection

Image source - http://news.bbc.co.uk

Thought this might come in handy for anyway wanting to test their code with some very basic collision detecion, it's by no means particulary accurate but is very simple to implement.

Click on image to view - you will be redirected to the image on imageshack - as blogger does not let you format code nicely ;-)

XNA simple collision detection code

After having a little look with Reflector it seems that when a .fbx model is compiled into a .xnb file that it automatically works out a BoundingSphere for that mesh, storing the information in the .xnb file. Then when creating a model and its subsequent meshes the ContentManager sets the BoundingSphere of that mesh to the value found in the .xnb file.

In my case I was using the spaceship model from the starter kit which only has one mesh. The BoundingSphere is rather large and so the spaceship only had to be in close proximity to the other and it detected it as a collision.
Read more

SOFTIMAGE|XSI Mod Tool - Free pro tool for XNA

FYI any budding modellers out there may be interested in "SOFTIMAGE|XSI Mod Tool" a free 400mb modeling and animation package that integrates straight into XNA (and Half-Life 2).

link to software:

Source - http://en.wikipedia.org/wiki/Softimage_XSI
Read more

The next step

Welp in the midst of dreaming up gigantic projects to tackle I have instead taken the sensible choice of taking my line of sight system into the third dimension :-) ...keep an eye out.. hmm donuts

Edit: Well maybe not that sensible, unhappy with just using bounding spheres I will attempt ObjectOrientedBoundingBoxes.. potentily involving some scary maths :-) hehe

Source - http://math.sfsu.edu/beck/images/simpsons.math.gif
Read more

It's here!!

Well the time has come where I have finished my XNA line of sight demo :D. You can find it at http://www.codeplex.com/XNAlineofsight
I intend to publish a utility tool that creates the vertice arrays for anyone using the source code. Also I will publish a tutorial that will explain in depth the code. Hope you enjoy
Read more