[Plugin] Leap Motion - Event Driven

  1. Make sure you character has “LeapAnimChildComponent”, and get the child of that component and cast it to your “AnimBodyConnector” blueprint (or whatever you rename it to). Set this to a variable.
  2. Call “GetLeapController” on the “AnimBodyConnector” node. This gives you direct access to the leap controller. From here, you can access the “Frame” object for the leap.

What I do is I run a polling service which records the last connection state for the leap each frame. I then compare this last connection state against the current connection state and I know that if they don’t match, then the leap motion connection state has changed. Either it was reconnected or it lost connection (USB unplugged?). I fire off a dispatcher event which let’s any subscribers know of these two events and they can handle it however they want.

Here is my polling blueprint node: