Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

LeapUDK : Leap Motion Controller Integration to UDK => Now with tutorial

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    LeapUDK : Leap Motion Controller Integration to UDK => Now with tutorial

    Hi to everyone !

    You will find a ready to use integration for Leap Motion Controller in Unreal Development Kit at the following link :

    https://twitter.com/hugolamarche/sta...24219905183744

    Edit : I've release the C++ source in a git depot. You will find instruction inside it

    https://bitbucket.org/HugoLamarche/leapudk/overview

    (Use the Mega link inside my tweet)

    Edit: a link to a video made with :


    Enjoy !

    #2
    Amazing stuff! I was looking at LeapMotion for a while.
    Thanks for the share!

    Any chance of a short/basic tutorial?

    Comment


      #3
      Thank you , I hope you will create some great UDK Leap game !

      In order to know how to use it simply follow the bitbucket link or read the readme into the archive.

      Comment


        #4
        Just to tell you that I have added a basic tutorial for how using it in UnrealScript in the readme (at the end).

        Here is the code in the readme :

        -----------------------

        // In the PlayerController members add this :
        var LeapUDK LeapUDK;

        -----------------------

        // Call init in PostBeginPlay of PlayerController
        LeapUDK = new class'LeapUDK';
        LeapUDK.initLeapMotion();

        -----------------------

        // Call uninit by GameInfo for PlayerController in preExit (to be sure to call it once)
        LeapUDK.uninitLeapMotion();

        -----------------------

        // Call this in the PlayerTick of the PlayerController and do your stuff with the hands and fingers info
        local int frameId;
        local int nbHands;
        local int nbFingers;
        local int iHand;
        local int iFinger;
        local int handId;
        local int fingerId;
        local vector palmPosition;
        local vector palmVelocity;
        local rotator palmRotation;
        local vector tipPosition;
        local rotator tipRotation;


        // Be sure that the leap motion is present and ready
        if (LeapUDK.isLeapMotionConnected())
        {
        // Update the currentframe and get the new frame id, idealy use this idealy to know if the frame change from the previous call
        LeapUDK.updateFrame(frameId);

        nbHands = LeapUDK.getNbHands();

        for (iHand = 0; iHand < nbHands; iHand++)
        {
        // Get the hands informations
        LeapUDK.getHandInfo(iHand, handId, palmPosition, palmVelocity, palmRotation);

        // Use here information abouts hands to do something

        nbFingers = LeapUDK.getNbFingers(handId);
        for (iFinger = 0; iFinger < nbFingers; iFinger++)
        {
        // Get the fingers informations
        LeapUDK.getFingerInfo(handId, iFinger, fingerId, tipPosition, tipRotation);

        // Use here information abouts fingers to do something

        }
        }
        }

        Comment


          #5
          Amazing. Thanks for this! Very helpful!

          Comment


            #6
            Your welcome, I hope it will help you to make your game work with Leap Motion

            Just one thing, there was a little mistake in the code : "LeapUDKgetHandInfo" instead of "LeapUDK.getHandInfo"

            Don't hesitate to add screenshot or video of your work here

            Comment


              #7
              Hello. I'm trying LeapUDK, reading readme.txt and etc.
              but uninitialize is anxiety.
              Could you teach me how to create this part?

              >// Call uninit by GameInfo for PlayerController in preExit (to be sure to call it once)
              >LeapUDK.uninitLeapMotion();

              I want to check log but can't see output. like this.
              class LeapGame extends UTGame;

              function PreExit()
              {
              `Log("----- Leap uninitialize -----");
              super.PreExit();
              //PlayerControllerClass.PreExit(); //can't compile. I'm noob...
              `Log("----- Leap uninitialize -----");
              }
              .
              .
              .
              defaultproperties
              {
              PlayerControllerClass=class'LeapUDK.LeapPlayerCont roller'
              }
              class LeapPlayerController extends UTPlayerController;

              var LeapUDK LeapUDK;

              function PreExit(){
              // Call uninit by GameInfo for PlayerController in preExit (to be sure to call it once)
              LeapUDK.uninitLeapMotion();
              `Log("----- Leap uninitialize -----");
              //super.preExit();
              }
              .
              .
              .
              hmm.. please help me

              Comment


                #8
                Hey,

                You have to add this in the gameinfo:

                event PreExit()
                {
                local AGPlayerController playerController;
                super.PreExit();

                foreach DynamicActors(class'AGPlayerController', playerController)
                {
                playerController.PreExit();
                }
                }

                Comment


                  #9
                  thank you @ntares!
                  I could see leap working.

                  This starting pattern is correctly done.
                  (....\UDK.exe **.udk -log) & exit command

                  but in editor.(Button 「Play this level in editor window...」)
                  Probably it can't release Leap , removeInstance() does't work.

                  hmm..!

                  Comment


                    #10
                    Hey Kunikane, actually I have trouble myself with the editor case, but try with the event Destroyed of actor to clear it at this point. Maybe it will work, not sure about this. If you find a better solution please post it

                    Comment


                      #11
                      Hi there,

                      Great work!

                      I'm trying to get your Leap functionality working in UDK but am coming across a problem. When I try to compile it says that the LeapUDK.uc can't bind to the LeapUDK.dll? The .dll is in the binaries/win32/UserCode folder and the .uc the appropriate scripts folder. Is there anything you could suggest to fix this?

                      Thanks

                      Comment


                        #12
                        Hi Laughing, try to copy the dll also to the binairies/win32 and make sure you are compiling with the 32 bit version of UDK.exe.

                        To be sure, simply launch UDK.exe in the win32 with "make" parameter like that :

                        "binairies/win32/UDK.exe make"

                        Comment


                          #13
                          Hi @ntares,

                          Thanks very much! That fixed it, I was trying to run the 64bit version

                          Thanks again!

                          Comment


                            #14
                            Glad to help you

                            Comment


                              #15
                              Hi there,

                              I was hoping you could help me out again. I'm trying to create a custom Kismet event that fires out the int value returned by the 'getNbHands' function in LeapUDK.uc. I have created the Kismet node but am having trouble accessing the 'getNbHands' int value.

                              Here is my code:
                              class SeqEvent_LeapUDK extends SequenceEvent;

                              var int numHands;

                              event Activated()
                              {
                              numHands = LeapUDK.getNbHands();
                              }

                              defaultproperties
                              {
                              ObjName="LeapUDK"
                              ObjCategory="LeapUDK"
                              VariableLinks(1)=(ExpectedType=class'SeqVar_Int',L inkDesc="numHands",bWriteable=TRUE,PropertyName="n umHands")
                              bPlayerOnly=false
                              }
                              As you can see I wish to assign the 'numHands' variable with the data from the returned int from 'getNbHands' and send it out of the node via the variable link but this does not work. I receive an Error, bad or missing expression in '='

                              Any thoughts on how I could fix this?

                              Thanks

                              Comment

                              Working...
                              X