Announcement

Collapse
No announcement yet.

Razer Hydra Plugin

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

    Originally posted by getnamo View Post
    This is a weird bug, I am still not sure of the exact cause and will probably need to debug this with some epic help sometime. In the meantime there is potentially a solution to your problem. Wrap up your hydra stuff into a blueprint actor component or a sub-actor. In there store the information you would like such as the hand positions/etc (also if its attached anywhere in the game e.g. your pawn, it will emit the input mapping events/keys), then reference those stored variables in your pawn classes. This will have the indirection you want and avoid the C++ base class error. Its also a good level of indirection, allowing you to add additional inputs while referencing the same data structures; you are no longer strictly bound to the hydra.
    I tried to create an actor component named "HydraComponent" with variables storing whether Hydra was enabled and what was its orientation.
    Click image for larger version

Name:	HydraComponent_BP.png
Views:	1
Size:	74.8 KB
ID:	1068067
    Put the HydraComponent into my character BP:
    Click image for larger version

Name:	PlayerPawn_BP.png
Views:	1
Size:	88.9 KB
ID:	1068073

    However even when I plugged the hydra controller in, the Event Hydra Controller Enabled was not triggered, so I restarted my project. This time it showed an error of "Can't find file for asset /Script/HydraPlugin" once started up, and the BP changed as below:
    Click image for larger version

Name:	HydraComponent_BP2.png
Views:	1
Size:	49.9 KB
ID:	1068076
    As my further check, the HydraInterface which I added before into Class Settings was no longer there for no reason. I tried several times and every time I restarted Unreal the HydraInterface in HydraComponent BP would just disappear.

    Comment


      Hi Getnamo!

      First off thank you so much for making this plugin!! It's been super helpful!

      Was wondering if you would be interested a writing a similar plugin, which would allow a motion capture system to stream into Unreal?

      Please let me know if this sounds like something you'd be interested in doing and I'll share details/budget with you.

      Looking forward to hearing from you.

      Thanks!

      Comment


        Hi all,

        Does anyone have a blueprint that they would be able to share for first person controls with the Hydra? I'm not a coder so it would save me a lot of time in order to test a few things out.

        Comment


          Originally posted by maxwood View Post
          Hi all,

          Does anyone have a blueprint that they would be able to share for first person controls with the Hydra? I'm not a coder so it would save me a lot of time in order to test a few things out.
          To control in first person you can simply use the input mapping system where you can use the joystick and button controls to move the character around e.g.


          There is also a rigged character provided by cleerusher123 earlier in the thread and guides on how to rig one up from about page 3. I plan to add a convenience rigged character to this plugin maybe around next week.
          Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

          Comment


            Since 4.7.4 (i believe that is the cause, but i'm not 100% sure) calling AddControllerPitchInput and AddControllerYawInput from an hydra delegate event doesn't have any effect if there is no HydraActor in the Map/Level, while it use to work anyway before. it took me hours to understand the reason it stopped working.
            I'm calling the methods from my HydraDelegate which is my PlayerController subclass, fron the virtual void HydraJoystickMoved, and it just doesn't work, i've debugged it, the method and code runs fine, the Values are different from 0 and correspond to the inputted value, but it just doesn't have any effect on the character, while instead, if i bind the Axis to the same method from "Engine Settings", it works, and if i just call AddControllerPitchInput from anywhere else with any values, it works.

            Comment


              My editor is constantly crashing with this plugin. using 4.7.4 at the moment but I had the same problem with earlier versions.

              Does anybody know how to do something about it? makes developing kind of impossible for me (using hydra)

              Comment


                Hi GetNamo,

                In the code's API, I was not able to find 'calibration' related method in there.
                What if I want to calibrate the initial position of the razer as start location at some location, what route would I go ?

                Comment


                  I'm also trying to figure out calibration. Can you show us how to do it?

                  Comment


                    Hi, GetNamo,

                    I am getting this error below.

                    I have created a 'A' class that is derrived from UOBject and FTickableObject.
                    and I created a 'B' class that is derrived from the 'A' and HydraDelegate.

                    Compile is working, date is all working good but somehow after around 20 seconds or so, it crashes with below messages.


                    MachineId:9EB1563042CDEFB5797C6DA20F58A34C

                    Access violation - code c0000005 (first/second chance not available)

                    UE4Editor_HydraPlugin!FHydraPlugin:elegateUpdateAllData() + 34 bytes [c:\trees\rs1\shootergame\plugins\hydraplugin\source\hydraplugin\private\fhydraplugin.cpp:277]
                    UE4Editor_HydraPlugin!FHydraPlugin:elegateTick() + 87 bytes [c:\trees\rs1\shootergame\plugins\hydraplugin\source\hydraplugin\private\fhydraplugin.cpp:327]
                    UE4Editor_HydraPlugin!FHydraPlugin::HydraTick() + 243 bytes [c:\trees\rs1\shootergame\plugins\hydraplugin\source\hydraplugin\private\fhydraplugin.cpp:271]
                    UE4Editor_ShooterGame!HydraDelegate::HydraTick() + 146 bytes [c:\trees\rs1\shootergame\source\shootergame\private\motionsensor\hydra\hydradelegate.cpp:136]
                    UE4Editor_ShooterGame!UShooterMotionCaptureHydra::Tick() + 50 bytes [c:\trees\rs1\shootergame\source\shootergame\private\motionsensor\shootermotioncapturehydra.cpp:42]
                    UE4Editor_Engine!UWorld::Tick() + 4464 bytes [c:\trees\rs1\engine\source\runtime\engine\private\leveltick.cpp:1171]
                    UE4Editor_UnrealEd!UEditorEngine::Tick() + 5618 bytes [c:\trees\rs1\engine\source\editor\unrealed\private\editor.cpp:1329]
                    UE4Editor_UnrealEd!UUnrealEdEngine::Tick() + 22 bytes [c:\trees\rs1\engine\source\editor\unrealed\private\unrealedengine.cpp:347]
                    UE4Editor!FEngineLoop::Tick() + 4179 bytes [c:\trees\rs1\engine\source\runtime\launch\private\launchengineloop.cpp:2257]
                    UE4Editor!GuardedMain() + 1404 bytes [c:\trees\rs1\engine\source\runtime\launch\private\launch.cpp:142]
                    UE4Editor!GuardedMainWrapper() + 26 bytes [c:\trees\rs1\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
                    UE4Editor!WinMain() + 249 bytes [c:\trees\rs1\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
                    UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

                    Comment


                      Originally posted by JaeYoo View Post
                      Hi GetNamo,

                      In the code's API, I was not able to find 'calibration' related method in there.
                      What if I want to calibrate the initial position of the razer as start location at some location, what route would I go ?
                      This part is now working. I just had to play with offset to initial data.

                      Comment


                        In case anyone needs this, here is how I figured out to rotate my "hands" correctly when using the hydra joystick to rotate the first person character:

                        Click image for larger version

Name:	L84Qvpy.png
Views:	1
Size:	505.9 KB
ID:	1075082

                        Comment


                          Click image for larger version

Name:	Hydra thread.png
Views:	1
Size:	309.8 KB
ID:	1076053
                          For some reason it doesn't draw the spheres and I can't tell if it's tracking then

                          Comment


                            Originally posted by DeathTempler View Post
                            ...
                            For some reason it doesn't draw the spheres and I can't tell if it's tracking then
                            Couple of things. I'm assuming you're following the video? This video was made back in 4.0 before a lot of best practices were established so it contains outdated ideas.

                            Why your example didn't work:
                            1) you're multiplying the value from the trigger change by 0, so the spheres will always be 0!
                            2) the position as you have it will show the hydra movements relative to absolute (map) 0,0,0 position which you may not see! You should add an actor position to that in order to have it relative to the actor location.

                            What you should be doing (this assumes the 3rd person template):

                            1a) Attach a hydra component to your chosen pawn/character blueprint



                            1b) Add a hydra interface



                            2) Right click in your blueprint and add the following graph to see your hydra position in a basic form



                            3) Use input mapping for joystick movements e.g.




                            This will give you the following in the 3rd person template



                            Where the left joystick was used to move the character and the right was used to look around with hydra right button 1 used for jumping.

                            In addition to that whenever the hydras are undocked you see a 10x10x10 cube shown for each hand with the position and orientation shown relative to the actor center.

                            If you want 1:1 calibrated input you should follow the guide in page 3 of this thread.

                            Hope this example helps!
                            Last edited by getnamo; 05-10-2015, 08:41 AM.
                            Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

                            Comment


                              Originally posted by JaeYoo View Post
                              Hi, GetNamo,

                              I am getting this error below.

                              I have created a 'A' class that is derrived from UOBject and FTickableObject.
                              and I created a 'B' class that is derrived from the 'A' and HydraDelegate.

                              Compile is working, date is all working good but somehow after around 20 seconds or so, it crashes with below messages.


                              MachineId:9EB1563042CDEFB5797C6DA20F58A34C

                              Access violation - code c0000005 (first/second chance not available)

                              UE4Editor_HydraPlugin!FHydraPlugin:elegateUpdateAllData() + 34 bytes [c:\trees\rs1\shootergame\plugins\hydraplugin\source\hydraplugin\private\fhydraplugin.cpp:277]
                              UE4Editor_HydraPlugin!FHydraPlugin:elegateTick() + 87 bytes [c:\trees\rs1\shootergame\plugins\hydraplugin\source\hydraplugin\private\fhydraplugin.cpp:327]
                              UE4Editor_HydraPlugin!FHydraPlugin::HydraTick() + 243 bytes [c:\trees\rs1\shootergame\plugins\hydraplugin\source\hydraplugin\private\fhydraplugin.cpp:271]
                              UE4Editor_ShooterGame!HydraDelegate::HydraTick() + 146 bytes [c:\trees\rs1\shootergame\source\shootergame\private\motionsensor\hydra\hydradelegate.cpp:136]
                              UE4Editor_ShooterGame!UShooterMotionCaptureHydra::Tick() + 50 bytes [c:\trees\rs1\shootergame\source\shootergame\private\motionsensor\shootermotioncapturehydra.cpp:42]
                              UE4Editor_Engine!UWorld::Tick() + 4464 bytes [c:\trees\rs1\engine\source\runtime\engine\private\leveltick.cpp:1171]
                              UE4Editor_UnrealEd!UEditorEngine::Tick() + 5618 bytes [c:\trees\rs1\engine\source\editor\unrealed\private\editor.cpp:1329]
                              UE4Editor_UnrealEd!UUnrealEdEngine::Tick() + 22 bytes [c:\trees\rs1\engine\source\editor\unrealed\private\unrealedengine.cpp:347]
                              UE4Editor!FEngineLoop::Tick() + 4179 bytes [c:\trees\rs1\engine\source\runtime\launch\private\launchengineloop.cpp:2257]
                              UE4Editor!GuardedMain() + 1404 bytes [c:\trees\rs1\engine\source\runtime\launch\private\launch.cpp:142]
                              UE4Editor!GuardedMainWrapper() + 26 bytes [c:\trees\rs1\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
                              UE4Editor!WinMain() + 249 bytes [c:\trees\rs1\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
                              UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
                              This sounds like garbage collection is releasing your references. I recommend using blueprint binds as it will be easier without custom memory management. You can still have your main class be in C++, but I would bind the hydra actions in blueprint and forward relevant data to data structures you need access to in C++.
                              Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

                              Comment


                                Originally posted by DeathTempler View Post
                                For some reason it doesn't draw the spheres and I can't tell if it's tracking then
                                Adding a hydra component directly to the chosen pawn/character blueprint did not work for me.
                                Option 2 from the post #133 on page 4 did the trick.
                                Last edited by stoppschildgruen; 06-02-2015, 07:38 PM. Reason: bad grammar

                                Comment

                                Working...
                                X