Best strategy to track object hierarchy using groups and obj files

by Alex   Last Updated September 13, 2017 14:13 PM

I am making a 3D game in OpenGL from scratch. In this game I have a ship with stuff inside it. How can I attach the stuff to the ship in the CAD program and maintain that hierarchy in my own game?

For example say I have a fire extinguisher in my ship that mounts on the wall. There are two approaches both with problems.

Solution 1: Save fire extinguisher and ship as separate obj files.

Problem: How can I place the fire extinguisher in the proper place inside my ship in my game? With hundreds of objects manually placing them is completely infeasible. I want to arrange stuff in my CAD and load it into the game and be done.

Solution 2: Save fire extinguisher as its own group inside the ship obj file.

Problem: Now I can't reuse the fire extinguisher in other ships. The obj files for game assets will balloon out of control in size with new instances of reused sub-objects.

Is there some way I can specify the position of an external object? A 3d point in my ship obj file representing the origin of another obj model?

Related Questions

LibGDX destroy object when not used

Updated May 13, 2015 20:05 PM

Design Pattern for "Default Object"

Updated May 13, 2015 12:43 PM