Hi everyone,
I'm designing my attach system and I have some doubts about it. Right now my hierarchy works like this,
I have an Object then from it I create Entity (everything that has an ID, Transform and goes into the scene/world) and also from Object I created a Mesh class, so it's kinda:
- Object (base class)
- Entity (parent Object)
- WorldObject (parent Entity)
- inside it will a ptr to Mesh, ex, Mesh* m_ptrMesh;
- Actor (parent Entity)
- Item (parent Entity)
-Mesh (parent Object)
For example, a tree (WorldObject) will have a model (Mesh) of Sakura_Tree.mdl.
My issue come when I want to attach an entity to another one (like, if I move the parent, all the childs will move), because it would be easy to create some Attachable class and add it to Entity with a list of all the child entities, but what about attaching to bone from models?
Example, if I want to attach an item to the back bone of the model, if the model doens't exist (or I remove it), should I also remove the item? One idea is to attach the item as a โchildโ of the Entity that holds the Mesh, and find the bone and given that bone, update the transform. (Attach the item to Actor player entity)
Any thoughts, examples or references about this issue?
Thanks!