Jump to content
  • Advertisement
Sign in to follow this  
a_metalhead

hello, prob in beginning 3d game programing

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
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 this post


Link to post
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 this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!