mandee.cabato.ph Posted April 20, 2012 Share Posted April 20, 2012 Is it possible to create custom classes that have their own update(), flush(), and render() functions that are automatically called by the engine without having to explicitly calling them from the world script? Link to comment
ulf.schroeter Posted April 20, 2012 Share Posted April 20, 2012 At least there always has to be one explict invocation from world or system script update(), flush() or render() functions. But you could define a centralized CustomObjectManager and a CustomObjectBase class where both classes implement update/flush/ender() functions. Within CustumObjectBase constructor/destructor each instance simply registers/deregisters itself at CustumObjectManager. On invocation of CustomObjectManager::update/flush/render() from within world/system script the manager simply invocates CustomObjectBase::update/flush/render() on all registered instances. Your actual custom classes only have to inherit CustomObjectBase and overwrite update/flush/render() functions as required. These implementations will then be invoked automatically by CustomObjectManager. 1 Link to comment
unclebob Posted April 20, 2012 Share Posted April 20, 2012 Hey, Mandee. No, there is no custom class update(), flush() or render() functions implicitly called from engine. But, as Ulf said, you can do this in Unigine Script by creating your own class hierarchy. Also, you can split your objects to subsystems and write a something like a manager to them, which will update(), flush() or render() objects properly. Link to comment
unclebob Posted April 20, 2012 Share Posted April 20, 2012 Also, you can use WorldExpression nodes for that. Please read more about using WorldExpression here: https://developer.unigine.com/en/docs/1.0/code/scripting/library/worlds/class.worldexpression Link to comment
mandee.cabato.ph Posted April 23, 2012 Author Share Posted April 23, 2012 Thank you for all your input. Much appreciated. Link to comment
Recommended Posts