hello, prob in beginning 3d game programing

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

Recommended Posts

hey evryone... i bought the beginning 3d game progrmaing book (by Tom Miller) and the 'tankers' example throws an exeption when i try to load the tank mesh hirocy... (it will even crash on the code that ships on the cd) dose anyone know how to fix this? mabey a prob with the mesh? thanks, ~metalhead

Share on other sites
hi,

is the file to be loaded there, where the prog looks for it?

kp

Share on other sites
yah there is... it loads the file, but then right when its loading the hirocy, it crashes

	public class tankAllocHi : AllocateHierarchy	{		public override Frame CreateFrame(string name)		{			tankFrame frame = new tankFrame();			frame.Name = name;			frame.TransformationMatrix = Matrix.Identity;			frame.CombinedTransformationMatrix = Matrix.Identity;			return frame;		}		public override MeshContainer CreateMeshContainer(string name, MeshData meshData, ExtendedMaterial[] materials, EffectInstance[] effectInstances, GraphicsStream adjacency, SkinInformation skinInfo)		{			tankMeshCont mesh = new tankMeshCont();			mesh.Name = name;			mesh.MeshData = meshData;			return mesh;		}	}	public class tankFrame : Frame	{		private Matrix combined = Matrix.Identity;		public Matrix CombinedTransformationMatrix		{			get{ return combined; }			set{ combined = value; }		}	}	public class tankMeshCont : MeshContainer	{	}

		public tank( Device pDevice )		{			device = pDevice;			AnimationRootFrame ar = Mesh.LoadHierarchyFromFile( gameEngine.mediaPath + TankMeshFile, 				MeshFlags.Managed , device , new tankAllocHi() , null ); // this is where it crashes			rootFrame = ar.FrameHierarchy as tankFrame;		}

Share on other sites
What exception does it throw?

Share on other sites
it is acualy just a message box - but im sure its an exeption

here are the contents of the box:

ERROR IN THE APPLICATION,
-(E_FAIL)
at: <then it recalls the call stack>
Just run the code and it works fine... But had to adjust the location of the media path in the appconfig file...

Make a copy of the complete media directory and move it to the main project directory. So you would then have the following

Tankers
- Source and solution files.
- Directory called framework
- Directory bin
- Directory obj
- Director Media

Then change the appconfig file media path in the solution app.config to
key="MediaPath" value="..\..\Media\Tankers\"
It should then run fine..

Posted what I did to get it to work here,
Forum Post

Share on other sites
thanks a whole lot!! :D im at school right now, but i cant wait to get it to [finaly] run ;)

Share on other sites
not working -_- i tryed it, and still no-go :(

Share on other sites
The Errors you explained above are becuase it can not find the files, I have got the code running and have posted the solution on my site if you are still having problems I can send you the code, but I would look at the file paths that are in the app.config file, you need to make sure that these point to the correct location.

http://www.ircomm.net/forums/33/ShowPost.aspx

Share on other sites
but it can find the stuff - it displays the GUI, and on the tank selection screen it shows the tank properly there... ???