Difference between revisions of "Obj2grid"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
(Translated readme.md from Github to Media Wiki style, added link to the tool.)
 
(There is absolutely no point in duplicating the information.)
 
Line 1: Line 1:
Obj2grid was created by Renol/Yoshi2 and can be found on his [https://github.com/RenolY2/obj2grid Github Repository].
+
Obj2grid was created by Renol/Yoshi2. It is a command line tool that converts Wavefront OBJ files to Pikmin 2 grid.bin (collision) and mapcode.bin (footstep sounds) files, and converts Pikmin 2 grid.bin files back into Wavefront OBJ.
  
__TOC__
+
== Download ==
 +
* [https://github.com/RenolY2/obj2grid GitHub repository]
  
==obj2grid==
+
[[Category:Tools]]
obj2grid is a command line tool that converts Wavefront OBJ files to Pikmin 2 grid.bin (collision) and mapcode.bin (footstep sounds) files, and converts Pikmin 2 grid.bin files back into Wavefront OBJ.
+
[[Category:Pikmin 2]]
 
 
==Requirements==
 
This tool requires Python 3. Newer = better (at the moment the newest version is 3.6 or so) When installing Python on Windows, make sure you check the box that says "Add Python to PATH" if you want to make use of the included .bat files.
 
 
 
==How To==
 
The .obj model file you want to convert needs to be triangulated (i.e. all faces are triangles and have exactly 3 vertices). If it isn't triangulated, obj2grid will throw an error.
 
 
 
For a quick set-up on Windows, drag your .obj file onto the included make_collision.bat which will create a grid.bin and a mapcode.bin out of your .obj file in the folder of the .obj file. In a similar way, drag a grid.bin file onto make_obj.bat to turn Pikmin 2 collision back into .obj.
 
 
 
===Command line usage:===
 
<pre>
 
python obj2grid.py [-h] [--cell_size CELL_SIZE] [--grid2obj] [--flipyz]
 
                  [--target_rarc TARGET_RARC]
 
                  input [output_grid] [output_mapcode]
 
 
 
positional arguments:
 
  input                Filepath of the wavefront .obj file that will be
 
                        converted into collision. If --grid2obj is set,
 
                        filepath of the grid.bin to be converted into .obj. If
 
                        input is a RARC archive (texts.szs/texts.arc) then the
 
                        grid.bin will be extracted from it.
 
  output_grid          Output path of the created collision file. If
 
                        --grid2obj is set, output path of the created obj file
 
  output_mapcode        Output path of the created mapcode file
 
 
 
optional arguments:
 
  -h, --help            show this help message and exit
 
  --cell_size CELL_SIZE
 
                        Size of cells in grid structure. Bigger can result in
 
                        smaller file but lower ingame performance
 
  --grid2obj            Use this option to create an OBJ file out of a
 
                        grid.bin file
 
  --flipyz              If option is set, the Y and Z axis are swapped.
 
  --target_rarc TARGET_RARC
 
                        Target RARC archive (texts.szs, texts.arc) into which
 
                        grid.bin and mapcode.bin will be written. The archive
 
                        needs to exist already.
 
</pre>
 
 
 
===Examples===
 
<code>python obj2grid.py --cell_size 100 MyCustomCollision.obj MyPikminGrid.bin MyPikminMapcode.bin</code>
 
 
 
<code>python obj2grid.py MyCustomCollision.obj --target_rarc "C:\Modding\Pikmin 2\user\Kando\map\tutorial\texts.szs"</code>
 
 
 
<code>python obj2grid.py --grid2obj MyPikminGrid.bin MyCollision.obj</code>
 
 
 
Note: you can use absolute file paths (i.e. ones starting with C:\ or C:/) so that your finished collision is put directly into the folder you want them in, see second example above.
 

Latest revision as of 17:26, 12 January 2019

Obj2grid was created by Renol/Yoshi2. It is a command line tool that converts Wavefront OBJ files to Pikmin 2 grid.bin (collision) and mapcode.bin (footstep sounds) files, and converts Pikmin 2 grid.bin files back into Wavefront OBJ.

Download[edit]