Jump to content
  • Advertisement
Sign in to follow this  
Raeldor

Tags in Scene Graph Hierarchy

This topic is 4746 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

Hi All, Currently I have a scene graph hierarchy with object types node (can have children and one parent and has transform matrix) and mesh (mesh is sub-classed from node as has shared pointers to geometry data). I want to attach a weapon to a model for example, so I was thinking of creating another sub-class of the node type called 'tag'. The scene graph would then look like this for example...
+- root (node)
   +- character (node) 
      +- torso (mesh)
      +- legs (mesh)
      +- upper arm (mesh)
         +- lower arm (mesh)
            +- hand (mesh)
               +- hand (tag)

Then I have a hand tag which can have a seperate transform matrix. If I then want to add a weapon I can add the object as a child of the hand tag to create a structure like...
+- root (node)
   +- character (node) 
      +- torso (mesh)
      +- legs (mesh)
      +- upper arm (mesh)
         +- lower arm (mesh)
            +- hand (mesh)
               +- hand (tag)
                  +- sword (object)
                     +- sword (mesh)

Is this how it is normally done? I have the geometry shared in my scene hierarchy not the objects, so I can keep the scene graph as a simple tree. Can anyone see any pitfalls in this approach? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
There's nothing inherently wrong with your idea. It's similar to a number of scene graphs. It does raise one question. How is a tag any different than a node? Why do you have a different type?

Share this post


Link to post
Share on other sites
One reason might be that a tag imposes restrictions on the types of nodes that can be attached to it:

hand
+- weapon_tag
+- sword

A tag could also be linked with an inventory system (through callbacks maybe?).

Alternatively the engine might not permit the dynamic (re)construction of hierarchies and tags could be one way of implementing that.

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!