Implement Leap Motion Controller for gesture handling
I'm struggling with Leap Motions C++ API to get gesture handling in my UE4 project to work. By now, the gesture handling works but the approach seems incredibly hacky to me and i'm pretty sure thats not the best way.
I've got this so far inside a tick function:
Because I derived from the LeapMotionControllerComponent, i have no "BeginPlay" or similar functions where I could set my controller and its settings once at start, instead i have to set it inside of my tick function over and over again.
Setting up Controller as a variable in header file is not possible aswell, due to its ... strange "instant" constructor trying to directly declare it (-> crash)
Is there any way to do this in a smarter way? And is it somehow possible to set up a Controller object globally, to use it in different functions and somehow set settings at startup? (without a beginplay method)
Any help or examples of actual real code (not leapmotion doc snippets) are appreciated.
I would create a pointer to a Controller and initialise it in your constructor, you can do this in the plugin class if you're implementing one or else have a singleton class. I did this in my Leap blueprint plugin before the official implementation was available and it worked without issues.
You could use OnRegister() instead of the class constructor. Just make sure you call Super::OnRegister() in your overriden body as well.
Follow this question
Once you sign in you will be able to subscribe for any updates here