Hello, this is my first post here.
I’ve found Urho3d recently and so far it seems like an engine I could get really comfortable to work with.
Currently, the most head scratching thing that stops me from working is the structuring of the game logic. I’ve read the forum and apparently the common way is to group code inside classes derived from LogicComponent.
What I can’t figure out is the right way to make other components accessible from the LogicComponent. By the right way I mean the one that won’t break some engine’s functionality down the road. For example, if I have Node and attached to it StaticModel and LogicComponent, how to register pointer to StaticModel inside LogicComponent the way it will be valid after deserialization?
I guess it definitely won’t work with manual binding during creation of components like:
I can look it up through the parent node inside LogicComponent’s OnNodeSet method and bind it that way:
MyLogicComponent::OnNodeSet()
{
staticmodelptr_ = this->GetNode()->getComponent(StaticModel::GetTypeStatic())
}
but this is supposed to work only when LogicComponents are added the last, seems kind of sloppy, also I can’t find if components are initialized in the original order during deserialization, if not this method won’t work as well.
Maybe I shouldn’t store pointer to the needed component in the member variable at all and instead search it through the parent node every time I need an access to it, but it feels non-optimal.
Am I missing some other way?