Physics File Generator

SFCBias

29-08-2011 04:27:52

I got this idea because in one of my projects, we ran into the problem of deciding what type of physics to assign at runtime to the objects. So I thought, maybe we don't have to. This is a command line tool (Because we all love command line, don't we) and is in early stages and therefore only supports Convex and Tree collision. This is also untested on Windows (so I don't even know if microsoft's compiler will accept the code but it should because its so extremely simple) because I haven't had a chance to jump into windows and compile it, consequently there is no project file for it, but hey, it *can't* be that difficult, its only one source file. Just like compiling a hello world project :)....not really.

But the help you compile: You need
1. Newton 2.3
2. Ogre 1.7 or higher (I assume)
3. Link against OgreMain AND Newton
4. The includes point to directories "OGRE/" and "Newton/" So either you need to change them to suit your
environment or just add an include directory to vc++ (or whatever your IDE is)

That should be all. Now let's talk about what the point of this is and how to use it.
Ofcourse, since this is command line, it provides a help dialog (Which should actually answer any questions you have) But anyways, You will use either '-c' or '-t' for convex or tree collision respectively, then the full path (can be relative) to the mesh (This is because Ogre's ResourceManager will spaz out if it can't find the resource). Then depending on your option will ask you for and ID, which can be used to identify your collision when you load the file into your program. If you choose triangle collision, it will also ask you for the type of face winding, this doesn't affect the collision very much and if you don't know exactly what it is or does, just go with the default (which will be in the brackets). Sooo, onward, if everything goes well, you should find your self with a file named "yourmeshfile.mesh.phys" which is a newton serialized collision file. And now when you load your objects, you can simply load the corresponding collision.

As always, you are welcome to submit changes to the source, additions, requests, etc. The source file can be found in the attachment. Any problems compiling please let me know.