Seems like you have a firm grip on the concepts, and that seems like a good track. Lot of ways to do something…
Note the controllers shared by JTippets and MonkeyFirst (much like mine ) have a ‘springtrack’ setting (see SpringPosition()) that causes the camera to smoothly ‘lerp’ to new positions.
For camera focus, here’s a simple component that uses the CameraController.
It’s not necessarily the most efficient or flexible, but it is dead easy (just add/remove from nodes) and would fit neatly in the CameraController header.
[code]
class CameraFocus : public Urho3D::Component {
URHO3D_OBJECT(CameraFocus, Urho3D::Component);
public:
CameraFocus(Urho3D::Context* context): Urho3D::Component(context) { }
~CameraFocus() { }
static void RegisterObject(Urho3D::Context* context) {
context->RegisterFactory();
}
protected:
void OnNodeSet(Urho3D::Node* node) {
SubscribeToEvent(Urho3D::E_POSTUPDATE, URHO3D_HANDLER(CameraFocus, HandlePostUpdate));
}
void HandlePostUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData) {
Urho3D::VariantMap& vm(GetEventDataMap());
Urho3D::Vector3 pos(node_->GetPosition());
vm[SetCameraPosition::P_POSITION] = pos;
node_->SendEvent(E_SETCAMERAPOSITION, vm);
}
};[/code]
edit: and just a reminder to register the Component, like in App constructor
CameraFocus::RegisterObject(context);