Hello,
i've a question about the Scene Graph. I want to create a system that allow you to create Empty GameObjets and later you can "compose" the GameObject with some simple objects like Mesh, Light, Camera. For example:
- Create GameObject "object1"
- Attach Mesh "mesh.x"
So now i've a gameobject composed by two elements: Empty GameObject and a Mesh for render. So when i try to translate it, my engine translate the father node "object1" and his child "mesh.x". (As Unity3D do).
Is that a good idea to manage my game objects? Can i use a Scene Graph system to compose my gameobjects? Have you some document that i can read?
Thanks a lot for you replies, and sorry for my bad english :).
P.S. I'm using C++ and DirectX 9.0.
Scene Graph to compose my gameobjects
I would suggest making everything traversable in the scene graph of a common base type and then build derived classes based on that type which you can 'attach' or add as child nodes to the parent basic type. Then supply different properties to these derived classes to create the functionality you want to add to the 'father'.
Like this:
These child nodes can inherit certain properties from their 'father' nodes, such as visibility status, world position and orientation etc.
Like this:
class mesh{ float *vertices[3]; // etc...};class game_object{ // 3d position in space float pos[3]; };class game_actor: public game_object{ // collection of meshes that are rendered std::vector<Mesh> actor_meshes;};
These child nodes can inherit certain properties from their 'father' nodes, such as visibility status, world position and orientation etc.
- game_object (x, y, z) | - game_actor (x, y, z), (mesh) | - game_actor (x, y, z), (mesh) |// or a more funky way of looking at it:- super_spaceship (124.51, 98.124, -32.55) | - laser_turret ( 0.1, 0.1, -1), (laser_mesh) | - laser_turret (-0.1, 0.1, -1), (laser_mesh)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement