Jump to content
  • Advertisement
Sign in to follow this  
Daggerbot

Multiple objects in a .obj

This topic is 3061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
A sample exported from Blender, consisting of one triangle object and one square object.


# Blender3D v249 OBJ File:
# www.blender3d.org
mtllib test.mtl
o Triangle_Plane.001
v -2.210575 -0.000000 -0.986309
v -2.210575 0.000000 1.013691
v -4.210576 0.000000 1.013691
usemtl (null)
s off
f 1 3 2
o Square_Plane
v 1.000000 -0.000000 -1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 1.000000
v -1.000000 -0.000000 -1.000000
usemtl (null)
s off
f 4 7 6 5

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!