PhysX Tool: Convert Physics Scenes into an OBJ file with PhysX2Obj



PhysX - PhysX2Obj


John Ratcliff has published a new useful code snippet for PhysX developers: PhysX2Obj.

PhysX2Obj allows to export a PhysX scene (a NxScene object) to an OBJ file. This functionality is useful for debugging for example (you can load the exported OBJ to check the right position of PhysX volumes).

PhysX2Obj has a single function:

int exportPhysX2Obj(NxScene *scene, 
                            const char *obj_file, 
                            bool worldSpace);

In any PhysX application simply include the header file ‘PhysX2Obj.h’ and invoke the single method ‘exportPhysX2Obj’.

You pass in a pointer to the scene you wish to export, the file name to save it as, and a bool indicating whether or not you want to export the data in world space or object space.

If you select world space, you will simply get one large Wavefront OBJ file with all of the static geometry in your game level.

If you select object space, it will export all of the geometry in object space and annotate the file, with comments, indicating where each object should be instantiated in the world.

You can download PhysX2Obj HERE (google code) or HERE (.h) and HERE (.cpp)

GeeXLab will love this function ;)

[source] | [via]





[ Subscribe to Geeks3D latest news by email ]

Geeks3D.com

↑ Grab this Headline Animator