Skip to main content
GameDev.net gamedev.net
🔒 Locked

.X Path Parser

Started by jad_salloum Oct 12, 2005 at 5:51 AM 2 replies 350+ views
Original Post
jad_salloum
jad_salloum
hi guys i made my path for my character to follow as a .X file , Books Say that it is easier to follow .X path while i think that it is hard coz 1st - i am using C# 2nd - i don't know how to make a template in C# 3rd - i don't know how to load this .X path file i am trying to load this path file as i load my all .X files but it is not loading so can anyone help me with this prob and is there any C# tutorials for this subject . i have a book called "Advanced Animation With DirectX" but it is in C++ Code and i find it hard to convert from C++ to C# . can anyone help me with this problem ??? and if u can please paste some code. thanx all.
dalep
dalep
I'm not sure what you are trying to do exactly. What's in this file?

There are a couple ways to load a .x file - one is to load it into a mesh object which is Mesh.FromFile with various parameters. This is the way you'd load it for drawing.

But I think you want it for something else? If you want to parse out a .x file, use the class family that has names starting with "XFile". - XFile, XFileLoader, XFileData, XFileInfo, etc.

But if all you want is a series of x/y/z points for your character to travel along, I don't really understand why you need a .x file for that. Certainly you could do it, but what's wrong with a generic text file with a series of points?
jad_salloum
jad_salloum

this file is like a dummy that contains a line curve for my character to follow as a path , i used Mesh.Fromfile but it is not loading it , and for the text file that contains a set of point's i don't think it is a good idea coz i am using a way with alot of curves this means alot of points and these points canot be accurate .

but for (( names starting with "XFile". - XFile, XFileLoader, XFileData, XFileInfo, etc. ))
i am trying to use them to load my file but i really don't know how to use them so if u have a little code that would help me in using them please post them ok thanx for ur help.
matthughson
matthughson
Quote:
Original post by jad_salloum

this file is like a dummy that contains a line curve for my character to follow as a path , i used Mesh.Fromfile but it is not loading it


When you say it is not loading it, is the Mesh being filed with garbage, or nothing at all? Have you checked to see that it can actually find the file?

Quote:
Original post by jad_salloum

the text file that contains a set of point's i don't think it is a good idea coz i am using a way with alot of curves this means alot of points and these points canot be accurate...


You might want to look into using splines or bezier curves. With them you can define perfectly smooth arcs and curves with very few points.

Good luck!
Matt Hughson
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.