Posted by
Allan
on Sunday, January 10, 2010
/
Comments: (0)
Before I go..
Posted by
Allan
on Friday, October 5, 2007
/
Comments: (0)
A quick guide to some of the fundamental math behind 3D programming. I won't explain to much as there is plenty of information on the net.
BTW a great article I found explaining the co-ordinate system.
http://creators.xna.com/Headlines/whitepapers/archive/2007/04/26/Shader-Series-supplemental-article-_1320_-Coordinate-systems.aspx
Tips:
1. Vectors:
What is a vector? simple its a point from a origin. Imagine a world with your axis, lets take the 0,0 (or in 3D 0,0,0) as the origin. When we create a new vector we are creating a point a certain distance away from that origin, so (5,2) is a vector 5,2 from the origin.
It is important to grasp this as we may want to manipulate a vector. Imagine we have two vectors in the world, (3,5) and (8,-1). They are both specifying a distance away from the origin, however what if we wanted (3,5) to be a distance away from the other point (8,-1)? Easy, we subtract (8,-1) from (3,5) we are now left with a vector that does just what we want.
2. Matrices
Transforming a point - When we transform a point we are applying one or more transformation matrice to a set of verticies. The order that we apply them in will affect the result.
Rotating a point (vector) - When we rotate a point we are rotating it around the origin, so if a point(vector) is for example (4,2) from the origin then when we rotate it it will be rotated as if orbiting this origin, thus if we want to rotate an object (like a spinning top) and not have it orbiting we need to move this object via translation to the origin, so -(4,2), then apply our rotation, then move the point back to its original position (4,2)
Read more
BTW a great article I found explaining the co-ordinate system.
http://creators.xna.com/Headlines/whitepapers/archive/2007/04/26/Shader-Series-supplemental-article-_1320_-Coordinate-systems.aspx
Tips:
1. Vectors:
What is a vector? simple its a point from a origin. Imagine a world with your axis, lets take the 0,0 (or in 3D 0,0,0) as the origin. When we create a new vector we are creating a point a certain distance away from that origin, so (5,2) is a vector 5,2 from the origin.
It is important to grasp this as we may want to manipulate a vector. Imagine we have two vectors in the world, (3,5) and (8,-1). They are both specifying a distance away from the origin, however what if we wanted (3,5) to be a distance away from the other point (8,-1)? Easy, we subtract (8,-1) from (3,5) we are now left with a vector that does just what we want.
2. Matrices
Transforming a point - When we transform a point we are applying one or more transformation matrice to a set of verticies. The order that we apply them in will affect the result.
Rotating a point (vector) - When we rotate a point we are rotating it around the origin, so if a point(vector) is for example (4,2) from the origin then when we rotate it it will be rotated as if orbiting this origin, thus if we want to rotate an object (like a spinning top) and not have it orbiting we need to move this object via translation to the origin, so -(4,2), then apply our rotation, then move the point back to its original position (4,2)
Bye bye XNA hello Silverlight
Posted by
Allan
/
Comments: (0)
Hi all,
Reluctantly I have decided to stop blogging on XNA and instead concentrate on Silverlight.
I have found XNA to be a great framework to get your feet wet in the big wide world of game programming, however creating a substantial game still takes a very long time to complete.
As such I have decided to concentrate on simpler web based flash type games utilising the power of Silverlight.
As I come to learn more I will start up a new blog so keep an eye out for silverlight4noobs ;-)
Read more
Reluctantly I have decided to stop blogging on XNA and instead concentrate on Silverlight.
I have found XNA to be a great framework to get your feet wet in the big wide world of game programming, however creating a substantial game still takes a very long time to complete.
As such I have decided to concentrate on simpler web based flash type games utilising the power of Silverlight.
As I come to learn more I will start up a new blog so keep an eye out for silverlight4noobs ;-)
Drawing primitives with game components
Posted by
Allan
on Tuesday, September 25, 2007
/
Comments: (0)
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;
graphics.GraphicsDevice.Indices.SetData(indices);
otherwise you may be wondering why your objects are not being drawn how you intended.
Read more
graphics.GraphicsDevice.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionNormalTexture.SizeInBytes);
graphics.GraphicsDevice.Indices = indexBuffer;
graphics.GraphicsDevice.Indices.SetData(indices);
otherwise you may be wondering why your objects are not being drawn how you intended.
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 ;-)
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.
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:
http://www.softimage.com/products/modtool/default.aspx
Source - http://en.wikipedia.org/wiki/Softimage_XSI
Read more
link to software:
http://www.softimage.com/products/modtool/default.aspx
Source - http://en.wikipedia.org/wiki/Softimage_XSI
The next step
Posted by
Allan
on Monday, September 10, 2007
/
Comments: (0)
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
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