Classic Battlefield Modding Wikia
Advertisement

Understanding the Obj format of a Navmesh

This can be important if your having problems with importing or exporting with your 3dsmax software. You may need to be able to check that the obj file is in the correct format.

Navmeshes use the wavefront obj format, which can be ready by a text editor such as notepad.

The navmeshes are either Infantry.obj or Vehicle.obj files. These .obj files are a list of text entries. 

They will look something like this: 



mtllib materials.mtl 
v -980.250000 156.614441 -676.459412 
...(etc) 
...(etc) 
...(etc) 
v 24.359142 25.200001 -26.198456 
g ground 
usemtl ground 
f 58729 60969 58731 
...(etc) 
...(etc) 
...(etc) 
f 78595 78594 78596 
g ladder 
usemtl ladder 
g water 
usemtl water 
f 18410 8453 48225 
...(etc) 
...(etc) 
...(etc) 
f 78586 78585 78587 
g deepwater 
usemtl deepwater 
f 70415 68484 47032 
...(etc) 
...(etc) 
...(etc) 
f 78532 78531 78533


Note:  There are lots of lines to define the vertices "v" and the faces "f".    Just a few entries are listed to show the syntax.  The "...(etc)" are to show there are lots more lines in the file. 


An .obj file defines several things: 

- the materials library and the file it uses to define the materials 
mtllib materials.mtl 

- All of the Vertices of the navmesh 
(a vertex is a point in space specified by the 3 coordinates) 
v # # # 

- All of the faces that make up the navmesh 
(a face is a triangle "made" from a material) 
f # # # 

- All of the Material Groups 
g ground 
g ladder 
g water 
g deepwater 

- All of the materials Used to make a "Face" 
usemtl ground 
usemtl ladder 
usemtl water 
usemtl deepwater 


An .obj file from BF2Editor will have each Material Group with the material directly below it because BF2Editor "gathers" all the entries of the same material together. 
i.e. 
g ground 
usemtl ground 


Every Face entry under a "usemtl" line all use the material at the top of the list. 
i.e. 
g ground 
usemtl ground 
f # # # 
... (etc) 
f # # # 


[ A navmesh created by BF2Editor will never have any faces under the "ladder" material.
[ DICE tried to get the bots to use ladders but ran into problems.
[ Since the ladder material already existed in BF2Editor the Material Group for ladder (g ladder)
[ and the "use material" entries for ladder (usemtl ladder) will always be created.
[ But, to keep the bots from getting "stuck" DICE changed BF2Editor so that it would never create
[ any faces with ladder material when it made a navmesh.
[ Also, the bot AI code was changed so that if a bot touched a "ladder" it would "jump off" and go somewhere else. 




Advertisement