Perhaps I'm missing something, but why copying & pasting doesn't work ?
A component, they way I see is, should be able to transform the Node in any possible way.
Node has some hardcoded physics logic in it, it should be possible to copy & paste it and put it in a component... just copy & paste the logic and all the physics ivars that are needed.
If you post an example with code regarding why you can't copy & paste the logic, I think I will be able to understand why it is not possible to reuse the same logic.
So, what I think is needed in order to copy&paste the original code, is to add one more callback to
Component... I think you need to broadcast
uint32_t Node::visit(const Mat4& parentTransform, uint32_t parentFlags)
uint32_t flags = parentFlags;
for(auto component: _components)
flags |= component->visit(parentTransform, parentFlags);
ComponentPhysics2d::visit you need to do something similar to
updateTransformFromPhysics(parentTransform, parentFlags); .
At least that is how I would do it in order to be as compatible as possible with the previous code.
And also it gives more flexibility to other components. On the other hand, this could slow down the
visit if not done correctly. Perhaps when you register a component, you pass a Hint flag saying which functions are overriden...