arvidsson/Mix

Maybe think of some way to get components through base component type

volcoma opened this issue · 1 comments

struct PhysicsBodyComponent
{
// some general data
};
struct RigidBodyComponent : public PhysicsBodyComponent
{
// some specific data
};
struct SoftBodyComponent : public PhysicsBodyComponent
{
// some specific data
};
auto e = world.CreateEntity();
e.AddComponent();

// somewhere else maybe a system's requirements
RequireComponent();
auto& component = e.GetComponent();

Better to add two components, the general and the specific one, than to rely on inheritance. I don't think it makes sense to have a hierarchy with components as it should be just data.