Announcement

Collapse
No announcement yet.

Razer Hydra Plugin

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

    #31
    Originally posted by Kashaar View Post
    You do realize that the source is included in the download, right?
    Oops my bad, gonna look into it now!

    Comment


      #32
      Originally posted by LoveTune View Post
      Hi getamo,

      Thanks for the help. I forgot to download the source code for 4.1 and ended up not being able to compile the project. It's all fixed but I can't run your plugin in 4.1.1.

      I am very new in this kind of stuff could you please tell me the process of updating a plugin so it can work for the newer version? Does it only involves re-compiling the plugin?



      I am not much of a programmer but I am going to make a VR project. I already have the first oculus the second version is coming :P.
      I am thinking of making a Virtual reality horror game where the player hold a flashlight/gun with razer hydra. Could you please tell me if the plugin provide the necessary functions to achieve it?

      Cheers
      Just checked, the 0.5.1 plugin version works on ue 4.1.1 so just make sure you have the latest plugin downloaded replacing the old one located in your project's Plugins folder.

      Plugin binds the Hydra to UE4, what you do with it is up to you, there are really no limitations.


      Originally posted by Strykeforce View Post
      @getnamo

      I also noticed that one of the axis (Yaw I think) is going from 90 to -90 so I can never get the full rotation, it just switches from 90 to -90 or vica versa. Good stuff that you are actively working on the plugin!

      Just a suggestion also, dont know if you want to keep the plugin closed source but it would be nice if this would be available via github or something so we can suggest or help with the plugin (even though im not so much into c++ but still)
      That's the data you get from the hydra API. To track rotations you will need to manually check for large changes in rotation (e.g. yaw going from -89 to +88 in one frame) and add/subtract full rotations to your input. This is how I solved the problem for my own project.

      I might add this capability to the plugin, but I generally prefer to keep plugins clean without extra convenience code.

      Also as Kashaar mentioned, source is included, but for your convenience, here's a github:
      https://github.com/getnamo/hydra-ue4
      Last edited by getnamo; 05-16-2014, 03:20 PM.
      Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

      Comment


        #33
        Just checked, the 0.5.1 plugin version works on ue 4.1.1 so just make sure you have the latest plugin downloaded replacing the old one located in your project's Plugins folder.
        I got a warning that the module is not compatible and recompiling may be necessary. How can I recompile the plugin?

        The plugin header etc is not really linked in my solution. What is the actual process to re-compile the plugin?

        Edit : Recompiled successfully following the step above. Thanks a lot
        Last edited by LoveTune; 05-17-2014, 05:52 AM.

        Comment


          #34
          Originally posted by getnamo View Post
          Just checked, the 0.5.1 plugin version works on ue 4.1.1 so just make sure you have the latest plugin downloaded replacing the old one located in your project's Plugins folder.

          That's the data you get from the hydra API. To track rotations you will need to manually check for large changes in rotation (e.g. yaw going from -89 to +88 in one frame) and add/subtract full rotations to your input. This is how I solved the problem for my own project.

          I might add this capability to the plugin, but I generally prefer to keep plugins clean without extra convenience code.

          Also as Kashaar mentioned, source is included, but for your convenience, here's a github:
          https://github.com/getnamo/hydra-ue4
          Alright so lets start off that I HATE angles and lots of math in general (despite being a programmer), but what I hate even more is adding hacks to solve a problem that gets created elsewhere. So bear with me while we go on a short journey here...

          So I dug around in the source code and since I write C# on a daily basis everything I tried for converting the rotation matrix to a quat failed, so that was fun. I decided to google some more for whacky rotation from the sdk and see if there were other people having the same problem and some have had problems with it as well, but not in the same kind!
          http://www.mtbs3d.com/phpbb/viewtopi...t=16051#p91610

          When I reached the end of the thread I was starting to think there is nothing we can do since they did not have a solution for the problem.
          Then in the following thread a thing called gimbal lock was mentioned:
          http://www.mtbs3d.com/phpBB/viewtopi...art=40#p144361

          So ok still bad luck I guess?, nope. The problem occurs because we break up the rotator to fix incorrect rotation, we lose the original rotator and so we get a gimbal lock on an axis because from there on out we are working with euler angles which have this problem.

          Since I can switch out params in C++ I did a bit of guessing and within 4 tries I fixed the rotator.

          Code:
          converted.rotation = FQuat(data->rot_quat[2], -data->rot_quat[0], -data->rot_quat[1], data->rot_quat[3]);
          Woop woop, pretty happy it works now and I can focus on my game!

          So in general guys, dont break up rotators, they dont like you if you do so!

          Edit: I just tried breaking up and making the rot again but not changing anything, that works so this confirms my HATE for doing math with angles
          Last edited by Strykeforce; 05-19-2014, 03:06 PM.

          Comment


            #35
            Well, maybe this will help... For reference, here's how I translated the rotation from the Hydra to UE's rotation system in Blueprints:



            It's just a different source coordinate system, it seems. Where in UE, X is forward, Y is sideways, and Z is up, the Hydra seems to use a different system where Y is upwards, Z is forwards, and X is sideways... unless I've got that mixed up. Edit: At least for rotation.

            I actually think it would be good if the plugin handled this coordinate system translation... it seems to work alright for positional tracking, at least.
            Attached Files
            Broad Strokes | Jan Kaluza | Marketplace Release: 'Over 9000 Swords' Modular Melee Weapon System
            Currently not available for freelance work
            Dev Blog & Tutorials | Twitter

            Comment


              #36
              Originally posted by Kashaar View Post
              Well, maybe this will help... For reference, here's how I translated the rotation from the Hydra to UE's rotation system in Blueprints:

              [img]

              It's just a different source coordinate system, it seems. Where in UE, X is forward, Y is sideways, and Z is up, the Hydra seems to use a different system where Y is upwards, Z is forwards, and X is sideways... unless I've got that mixed up. Edit: At least for rotation.

              I actually think it would be good if the plugin handled this coordinate system translation... it seems to work alright for positional tracking, at least.
              Read my post I fixed the plugin so the UE4 engine gets the correct rotator cause now you probably have the same problem: when you rotate the hydra in a way you it freaks out and rotates in a weird or opposite way.

              I've proposed the change I made in code on github, if you want to try it out for yourself you can edit the "Plugins/HydraPlugin/Source/HydraPlugin/Private/FHydraPlugin.cpp" file with the rotator fix.
              Last edited by Strykeforce; 05-20-2014, 02:15 AM.

              Comment


                #37
                Hm, are you sure? Because I don't have that problem. But might it be related to what actor/component rotation function you use, maybe? I know that there is one rotation node in BP that is basically like FPS rotation (pitch is clamped to -90 to 90), and another that isn't, which gives you free rotation. Can't check right now which is which since I'm not near a computer, though.
                Broad Strokes | Jan Kaluza | Marketplace Release: 'Over 9000 Swords' Modular Melee Weapon System
                Currently not available for freelance work
                Dev Blog & Tutorials | Twitter

                Comment


                  #38
                  I'm sure, getnamo had this same problem but was calculating new data with history data and by doing so avoiding the real problem.

                  Anyway the rotation should be correct from the plugin to use with UE4, its crazy to constantly have 2 or more nodes in blueprint to convert the rotation. There is not a single use case I can imagine for using the inverted/wrong rotation, you will always have to convert it.

                  Try rotating every axis of the hydra controller to over 90 degrees, im quite positive you will see the same gimbal lock. I'm using a gun mesh that rotates accordingly to the rotation of the hydra controller.

                  Comment


                    #39
                    Originally posted by Strykeforce View Post
                    ...

                    Code:
                    converted.rotation = FQuat(data->rot_quat[2], -data->rot_quat[0], -data->rot_quat[1], data->rot_quat[3]);
                    Woop woop, pretty happy it works now and I can focus on my game!

                    So in general guys, dont break up rotators, they dont like you if you do so!

                    Edit: I just tried breaking up and making the rot again but not changing anything, that works so this confirms my HATE for doing math with angles
                    Kashaar brought this up earlier, but this solution is what made me dig in and update my quaternion knowledge. TIL you can change quat coordinate system by effectively ignoring the W component and just swapping x,y,z around.

                    In general UnrealX = - SixenseZ UnrealY = SixenseX UnrealZ = SixenseY. I had this fixed for position, but because of (fearing) the quaternion, left the rotation for a later day. The caveat is that the values coming from hydra rotation are inverted, which means you have invert each axis and this is why your solution is correct.

                    Thanks for this and I've patched it into v0.5.2 of the plugin.

                    Please note that the rotation count issue is separate from the gimbal lock and if you want to count revolutions you will still need to check for big rotation changes.
                    Last edited by getnamo; 05-20-2014, 10:14 AM.
                    Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

                    Comment


                      #40
                      Originally posted by getnamo View Post
                      ...
                      I had this fixed for position, but because of (fearing) the quaternion, left the rotation for a later day. The caveat is that the values coming from hydra rotation are inverted, which means you have invert each axis and this is why your solution is correct.

                      Thanks for this and I've patched it into v0.5.2 of the plugin.

                      Please note that the rotation count issue is separate from the gimbal lock and if you want to count revolutions you will still need to check for big rotation changes.
                      Maybe we should start a club for people in fear of quaternions!

                      Comment


                        #41
                        Hi, getnamo

                        Seeing what you're capable of controlling the hydra, you may be able to create a plugin to control arduino boards?

                        It would be interesting to create simulators with the new vehicle system.
                        Thanks in advance.

                        Comment


                          #42
                          Not being a programmer myself would some kind person please upgrade this awesome plugin to 4.2. Thanks very much
                          Stygian Abyss Demo VR Remake

                          http://mrob76u.wordpress.com/

                          Comment


                            #43
                            Hi getnamo,
                            Please upgrade it, or tell me how to compile it to 4.2.
                            Would be very kind!

                            Comment


                              #44
                              @Uni Koblenz &
                              Originally posted by Mrob76u View Post
                              Not being a programmer myself would some kind person please upgrade this awesome plugin to 4.2. Thanks very much
                              There should be a new version available tomorrow (I'm still trying to fix the Shipping vs Editor issue with the plugin). If you can't wait, you can follow the steps outlined earlier in the thread about how to update your project.

                              @Melkor
                              I'm not familiar at all with arduino boards, if you have some programming knowledge you should be able to change the plugin code with your knowledge of the boards to make your plugin.
                              Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

                              Comment


                                #45
                                Thanks getnamo. Very much appreciate your hard work. Did you get anywhere with adding support for input mapping? It's not essential as I have most stuff working now but it would just make it a bit neater. Thanks again.
                                Stygian Abyss Demo VR Remake

                                http://mrob76u.wordpress.com/

                                Comment

                                Working...
                                X