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

Multiple objects in a .obj

Started by Daggerbot Mar 1, 2010 at 7:41 PM 1 replies 16k views
Original Post
Daggerbot
Daggerbot
I have a question about storing multiple objects in a Wavefront .obj file, as the docs I have read aren't too clear on the subject. Does each sub-object have its own set or vertices, or are they shared within the entire file? For example:
# style 1
o object_1
v 0.0 0.0 0.0
v 1.0 0.0 0.0
v 1.0 0.0 1.0
v 0.0 0.0 1.0
f 1 2 3 4

o object_2
v 0.0 2.0 0.0
v -1.0 -1.0 0.0
v 1.0 -1.0 0.0
f 1 2 3

# style 2
v 0.0 0.0 0.0
v 1.0 0.0 0.0
v 1.0 0.0 1.0
v 0.0 0.0 1.0
v 0.0 2.0 0.0
v -1.0 -1.0 0.0
v 1.0 -1.0 0.0

o object_1
f 1 2 3 4

o object_2
f 5 6 7
My maps are designed in a way that requires use of .objs with multiple objects, so I need to figure this out before I can continue. Any help is appreciated.
karwosts
karwosts
A sample exported from Blender, consisting of one triangle object and one square object.

# Blender3D v249 OBJ File: # www.blender3d.orgmtllib test.mtlo Triangle_Plane.001v -2.210575 -0.000000 -0.986309v -2.210575 0.000000 1.013691v -4.210576 0.000000 1.013691usemtl (null)s offf 1 3 2o Square_Planev 1.000000 -0.000000 -1.000000v 1.000000 0.000000 1.000000v -1.000000 0.000000 1.000000v -1.000000 -0.000000 -1.000000usemtl (null)s offf 4 7 6 5
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
Daggerbot
Daggerbot
Thanks! That's exactly the kind of example I was looking for.

Topic Locked

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

Sign in to reply to this topic.