dongju.jeong Posted January 31, 2019 Posted January 31, 2019 how can i use callbackbase ?? It seems similar to the c# delegate, but I think the usage is different. VR sample code does not seem to connect any function to callbackbase variable, but it calls the run function (+ argument) What function does called when use_callback run?
cash-metall Posted January 31, 2019 Posted January 31, 2019 A Сallbackbase is class for working with pointers to functions or methods. (simple analog for std::function) use_callback->run() will run the callback, that you put in VRPlayer::setUseCallback(Unigine::CallbackBase* callback) for creating callback use MakeCallback
dongju.jeong Posted February 1, 2019 Author Posted February 1, 2019 setUseCallback function is seems not uesed yet in VR sample. Is it designed to be used in person if necessary?
fox Posted February 1, 2019 Posted February 1, 2019 Yes, in this particular case it is designed to let you set your own callback function for "use" action. For example, you can specify a custom callback for the Vive player like this: // callback function to be called for "use" action void VRPlayerVive::my_custom_callback(NodePtr node) { // your code goes here } /* ... */ void VRPlayerVive::init() { /* ... */ // setting my_custom_callback for "use" action setUseCallback(MakeCallback(this, &VRPlayerVive::my_custom_callback)); } } In this case use_callback->run(someNode) will actually call my_custom_callback(someNode) . Thank you! 1
Recommended Posts