User Tag List

Page 1 of 9 123 ... LastLast
Results 1 to 40 of 356

Thread: Razer Hydra Plugin

  1. #1
    0

    [Plugin] Razer Hydra

    An event driven plugin for the Razer Hydra. Check out the video for a quick tutorial.

    Since version 0.8, the plugin works through both Unreal Engine Motion Controller and Input Mapping abstraction as well as through a convenience component for hydra specific events and functions.

    Forward me your suggestions and let me know if this helped you!

    Only supported in Windows 64 & 32 Platform.

    Download


    Read the Github readme for the latest documentation,



    Older
    v0.8.10 for UE 4.13
    v0.8.9 for UE 4.12
    v0.8.8 for UE 4.11
    v0.8.6 for UE 4.12-VREditor - Fun but experimental, pretends to be a vive wand
    v0.8.3 for UE 4.10
    v0.8.2 for UE 4.9
    v0.7.8 for UE 4.8
    v0.7.7 for UE 4.7
    v0.7.6 for UE 4.6
    v0.7.4 for UE 4.5
    v0.6.5 for UE 4.4
    v0.6.3 for UE 4.3
    v0.5.3 for UE 4.2
    v0.5.2 for UE 4.1

    Resources
    Github - Main Plugin Source and Documentation
    Sixense UE4 Plugin thread


    Installation (0.8 or newer)
    1. Download plugin
    2. Create new or choose project.
    3. Browse to your project folder (typically found at Documents/Unreal Project/{Your Project Root})
    4. Copy Plugins folders into your Project root.
    5. Restart the Editor and open your project again.
    6. Select Window->Plugins. Click on Installed and you should see a category called Input and a plugin called Hydra Plugin now available. It should be automatically enabled, if not, Select Enabled. The Editor will warn you to restart, click restart.

    Use Cases
    Input mapping is recommended for Joystick and Button mapping, use Motion Controller Components for x,y,z


    How to use it - Motion Controllers
    Please refer to the Motion Controller Component Setup unreal documentation as this setup is hardware agnostic. Since 0.9 a basic motion controller setup should look like this:



    Where visible static meshes are parented to the motion controllers which are in turn parented to a chosen offset, forward by 40cm from the camera in this particular example.

    No hydra specific component is required, tracking is handled internally and passed to the agnostic motion controller components and the input mapping system. Tracking should defer to other motion controllers if unplugged or docked.

    Input Mapping

    You can use either the Motion Controller input mapping (IM) events



    or hydra specific ones




    Other Resources:

    Video Series
    2-part tutorial series by Weevilman, based on the 0.8.2 for UE 4.9.

    Part 1


    Part 2


    Changelist

    0.9.5
    -UE4.15 update

    0.9.4
    -fixed derived values (acceleration, velocity and angular velocity)

    0.9.3
    -fix unplugged event not triggering

    0.9.2
    -No hydra specific components required for full tracking. If you're using Input Mapping + Motion Controller abstraction, just follow UE hardware abstracted documentation. This is the recommended method of using the plugin.
    -Optional HydraControllerComponent used to receive 0.8 style hydra specific events and poll for additional data
    -Hydra data now encapsulated as a HydraControllerData UStruct and emitted in the custom events
    -Historical data removed, use a generalize structure instead
    -C++ method should now access data in the same form as blueprints.
    -4.14 update
    -Input mapping keys renamed to fit closer to how Motion Controller keys are named.
    -documentation update for new API

    0.8.9
    -Merged compile fixes for 4.12
    -Updated binaries

    0.8.8
    -Changed to git flow, look for latest downloads under https://github.com/getnamo/hydra-ue4/releases
    -Uses send controller event for late update only not tick
    -added docs url and changed load order
    -added world scaling support from vr-editor
    -dependencies moved to saner locations

    0.8.3
    -Updated to 4.10
    -Experimental branch merged into master

    E0.8.2
    -Added ButtonPressed and ButtonReleased events to HydraPluginComponent
    -Cleaned up code a bit
    -Added ability for the plugin to auto-hide your attached MeshComponents,
    see readme for details.

    E0.8.1
    -Added HydraPluginComponent with Blueprint Assignable Multi-Cast
    Delegates. Click the component and click + to add an event subscription
    to the current blueprint
    -Plugin components and their events are now multi-cast add them wherever
    you want
    -Added input mapping events for each controller dock/undock
    -Fixed PIE crash, seems stable now
    -Removed Binaries folder, just drag and drop Plugins. Packaging does
    copy the require dll, but may not run.

    E0.8.0
    -Update to 4.9
    -Adds support for UE 4.9 hardware agnostic Motion Controller interface,
    both for Input Mapping and Left/Right hand 1:1 motion.
    -This commit removes past compatibility, wait for stable release if you
    wish to have both.

    0.7.8
    -Update to 4.8

    0.7.7
    -Update to 4.7
    -Fixed a memory leak.

    0.7.6
    -HydraPlayerController will no longer cause a crash when used in project.

    0.7.5
    -contains all compile fixes and prebuilt binary for UE4.6

    0.7.4
    -Changed AnyButtonPressed event into ButtonPressed(enum
    HydraControllerButton) and ButtonReleased(enum HydraControllerButton)
    allowing for a single event to handle all buttons if desired.
    -Reduced controller lag by 1 frame, this was introduced in 0.7 due to a
    bug from blueprint controller class extension

    0.7.3
    -Minor code consistency fix
    -Added white listing of only supported (windows) platforms

    0.7.2
    -fixed a crash caused by not having your interface set. This will not
    longer cause your session to crash, but instead emit log and on-screen
    errors.

    0.7.1
    -Synced folder layout with other plugins. To install you now need to copy both Binaries and Plugins
    -Added support for 32bit shipping build, for either packaged or shipping build copy Binaries after packaging has been complete.

    0.7
    -Updated to UE4.5
    -New Component based system using interfaces; now able to extend any
    blueprint class to have a Hydra component and receive the HydraInterface
    events! See readme or unreal thread for details.
    -All events now emit a UHydraSingleController, allowing for easy probe
    of additional data at the event state.
    -Some compatibility may be broken, but old style C++ extension is still
    possible using the old delegate (still retained). New style C++ plugin
    extension leads to less code, see convenience actor for details.

    0.6.5
    -Fixed C++ input mapping, if you're extending your own project class with the hydra delegate, make sure to copy HydraDelegate.cpp found in the plugin source into your project source; this will allow the project to compile for the editor. Remove when compiling for shipping to stop duplicate file error caused by compiler collapsing the dll into single exe.

    0.6.4
    -Updated to UE4.4

    0.6.3
    -Added shipping build convenience folder, package and copy the slimmed down Plugins folder to enable the plugin.
    -See shipping post, github, or wiki for shipping instructions and troubleshooting.

    0.6.2
    -Added integrated angular velocity support, updated data, functions, and events to reflect
    -C++ class extension needs less filler code, see HydraPluginActor/HydraPlayerController for examples of updated syntax.
    -Moved core functionality from the delegate into the plugin
    -Historical Data now a pointer to plugin data instead of holding own copy of data.
    -Removed Slate dependency from Delegate
    -Removed IHydraPlugin.h dependency from HydraDelegate sub-classes
    -HydraPluginActor is now added to the input chain if its used by default, allowing it to receive input mapping events.
    -Bug Fixes


    Older Resources
    -v0.7 Quick Setup and How to Use.
    -Wiki - Currently Outdated, use github for documentation
    -Plugin v0.5 video, still relevant regarding general setup, use with blueprint convenience actors, and C++ class extension.
    Last edited by getnamo; 05-09-2017 at 02:44 PM.

  2. #2
    0
    Infiltrator
    Join Date
    Apr 2014
    Posts
    15
    Wow, thanks for this! Sixense is planning STEM (and Hydra backward compatible) UE4 support, but not til post STEM launch. This'll be great in the meantime to get started working on ideas.

    Source

    All I can say at this point is that we are currently working on native integration into UE4. I can't promise that it'll be available prior to the STEM system launch, but it will of course be backwards compatible with the Razer Hydra.
    Edit: Looks like you've posted in that very thread. Congrats on figuring it out!
    Last edited by Rirath; 04-23-2014 at 07:12 PM.

  3. #3
    0
    Infiltrator
    Join Date
    Apr 2014
    Posts
    15
    Wanted to make one more post to say I just had a chance to watch the tutorial - it was excellent! Thank you for the through explanation and the blueprint (and C++) examples.

    Much appreciated.

  4. #4
    0
    Luminary
    Join Date
    Mar 2014
    Posts
    1,679
    Hey Getnamo,

    I would like to say awesome work for figuring this out.

    Cannot wait to get started working with this.

  5. #5
    0
    Thanks for making / posting this! nice work! glad we don't have to wait for Sixense to implement something.

  6. #6
    0
    Other than the few crashes this works an absolute charm! Well done I think we all owe you a beer!

    A nice straight forward tutorial too.

  7. #7
    0
    I love it so far, the code is very neatly written and integrates with everything the proper way.

  8. #8
    0
    Plugin needs an update for 4.1 I guess now it says it is not compatible.

  9. #9
    0
    Quote Originally Posted by AntonieB View Post
    Plugin needs an update for 4.1 I guess now it says it is not compatible.
    I'll have a look and recompile.

    NB: You do have the full source to the plugin

  10. #10
    0
    Quote Originally Posted by getnamo View Post
    I'll have a look and recompile.

    NB: You do have the full source to the plugin
    Will look into the source / compiling it myself if only for educational purposes.

    Thanks again for your work already.

  11. #11
    0
    Plugin Updated for 4.1 with small code consistency and comment changes and a new readme.
    Download V0.5.1

    If you want to recompile the earlier 0.5 in your project instead follow these guidelines from epic:
    - Upgrading C++ code projects
    * You’ll need to recompile the C++ project for the new version of Unreal Engine
    * Locate the .uproject file in your game’s folder, and right click on it. (on Mac, you can also Command + Click)
    * Select Switch Unreal Engine Version -> 4.1 (on Mac, this is in a Services menu)
    * Right click to generate new C++ project files, then recompile your game normally.
    * Note: Some C++ APIs may have changed between versions, which can cause compile errors. Read the API Changes section for more information.
    Last edited by getnamo; 04-24-2014 at 07:46 PM.

  12. #12
    0
    Fantastic work. Thank you so much. Is it possible to use the joysticks and buttons on the Hydra with the input and axis mappings in the engine?

  13. #13
    0
    Quote Originally Posted by Mrob76u View Post
    Fantastic work. Thank you so much. Is it possible to use the joysticks and buttons on the Hydra with the input and axis mappings in the engine?
    I haven't bound this myself but it should be doable using the guidelines outlined in https://www.unrealengine.com/blog/input-action-and-axis-mappings-in-ue4

    Not 100% sure on the how part as of yet as the standard for custom input is not fully documented. This is why the plugin provides maximum flexibility as you can extend your own class to handle inputs and therefore place it where you feel it is most relevant for your project.

  14. #14
    0
    Unreal Engine Developer
    Join Date
    Mar 2014
    Posts
    300
    Really great work, very excited to see people integrating technologies like this in to UE4.

    Quote Originally Posted by Mrob76u View Post
    Is it possible to use the joysticks and buttons on the Hydra with the input and axis mappings in the engine?
    This was one of the things I was wondering about as well. If you're interested in extending the plugin to implement the input system integration I'd be happy to help point you in the right directions.

    One of the intentions of the way that FKey references inputs by FName is that adding new inputs in a plugin should be straightforward, however, it does not have a plugin based consumer of the API that I'm aware of yet.

    The first step would be to call EKeys::AddKey for each of the new keys, probably as part of your module initialization. Then in your module you would need a tickable object, potentially using FTickableGameObject which pumps calls to FSlateApplication. Probably OnControllerAnalog, OnControllerButtonPressed/Released, and possibly OnMotionDetected, though I'm imagining there is some work that needs to be thought out about how to make the motion functions work with the two controllers.

  15. #15
    0
    Quote Originally Posted by Marc Audy View Post
    Really great work, very excited to see people integrating technologies like this in to UE4.



    This was one of the things I was wondering about as well. If you're interested in extending the plugin to implement the input system integration I'd be happy to help point you in the right directions.

    One of the intentions of the way that FKey references inputs by FName is that adding new inputs in a plugin should be straightforward, however, it does not have a plugin based consumer of the API that I'm aware of yet.

    The first step would be to call EKeys::AddKey for each of the new keys, probably as part of your module initialization. Then in your module you would need a tickable object, potentially using FTickableGameObject which pumps calls to FSlateApplication. Probably OnControllerAnalog, OnControllerButtonPressed/Released, and possibly OnMotionDetected, though I'm imagining there is some work that needs to be thought out about how to make the motion functions work with the two controllers.
    Interesting, I'll definitely ask you some questions on this after looking at it sometime later this week. The concept is clear, but its always the devil in the details. I remember looking at this earlier, but without success in finding direct examples (all native keys and gamepad binds seem to be buried in the engine).

  16. #16
    0
    This is pretty awesome! I just integrated Hydra support into a fresh template project and am happily moving around and rotating two gizmos with the hydras

    Would it be helpful to anyone if I released my HydraInputActor-derived blueprint that handles almost all the things?

    One thing I've noticed, Hydras rotation and joystick structs seem to be not directly mapped to UE4's... for example, Sixense's Pitch is UE's Yaw, Yaw is inverted Roll, and Roll is inverted Pitch. Though I'm not sure if this isn't maybe because of the project template and perspective I was using.

    In any case, great job on getting the Sixense stuff integrated! Plugin install was very simple and worked right away, so thanks for that!
    Broad Strokes | Jan Kaluza | Marketplace Release: 'Over 9000 Swords' Modular Melee Weapon System
    Currently available for freelance work
    Dev Blog & Tutorials | Twitter

  17. #17
    0
    Quick question -- this is really a fantastic contribution, it's a shame that Sixense aren't doing a bit more to support you with it.

    I'm having a problem with it on OS X, I follow the steps in the tutorial (drag the plugin folder to the project folder), and when I click Enable on the list of installed plugins, after restart I get the following alert:

    Plugin 'HydraPlugin' failed to load because module 'HydraPlugin' could not be found. This plugin's functionality will not be available, etc etc.


    I see in the folder structure there's a binaries folder for Win64. I'm sure I can't just rename this, but is there a good way to get binaries for Mac or is that not the cause of the error?
    Thanks, so much.
    Last edited by filmicarty; 05-09-2014 at 03:37 AM.

  18. #18
    0
    Fantastic. I just made support for the hydra in my game with you'r plugin, it works really well and no crashes for me yet hehe. only one question tho, how do i separate the controller so i get Vector2D info from one stick only and not both via blueprint?

    Thank you very much for the plugin it's a life saver when sixsense is be a little slow.

    BallisticDK

  19. #19
    0
    Quote Originally Posted by filmicarty View Post
    Quick question -- this is really a fantastic contribution, it's a shame that Sixense aren't doing a bit more to support you with it.

    I'm having a problem with it on OS X, I follow the steps in the tutorial (drag the plugin folder to the project folder), and when I click Enable on the list of installed plugins, after restart I get the following alert:

    Plugin 'HydraPlugin' failed to load because module 'HydraPlugin' could not be found. This plugin's functionality will not be available, etc etc.


    I see in the folder structure there's a binaries folder for Win64. I'm sure I can't just rename this, but is there a good way to get binaries for Mac or is that not the cause of the error?
    Thanks, so much.
    The plugin currently only supports Windows. I haven't tried integrating other platforms yet, this is something I wish I had the time to do properly, instead I used a direct DLL bind which is windows only api. The plugin does come with the full source, so if you feel like you can integrate it, go for it! (it's probably only missing the sixense osx dylib which can be found in the latest SDK from sixense). Otherwise the best action would be to wait for the official plugin .

    Quote Originally Posted by PMBallisticDK
    Fantastic. I just made support for the hydra in my game with you'r plugin, it works really well and no crashes for me yet hehe. only one question tho, how do i separate the controller so i get Vector2D info from one stick only and not both via blueprint?

    Thank you very much for the plugin it's a life saver when sixsense is be a little slow.
    Each blueprint event emits an integer called 'controller'. Simply add an IF statement and compare it to the controller you want (typically 0 for left, 1 for right) and any statements after that IF statement will only be for the controller you want. Additionally if you want to support people potentially misplacing their controllers, you can make a call to 'HydraWhichHand(int32 controller)' which will determine which hand the controller is being held in (returning 0 for left, 1 for right). This is determined by where the controller was last docked (which side of the dock it was).
    Last edited by getnamo; 05-09-2014 at 08:26 PM.

  20. #20
    0
    Quote Originally Posted by getnamo View Post
    Each blueprint event emits an integer called 'controller'. Simply add an IF statement and compare it to the controller you want (typically 0 for left, 1 for right) and any statements after that IF statement will only be for the controller you want. Additionally if you want to support people potentially misplacing their controllers, you can make a call to 'HydraWhichHand(int32 controller)' which will determine which hand the controller is being held in (returning 0 for left, 1 for right). This is determined by where the controller was last docked (which side of the dock it was).

    Fantastic Thank you

  21. #21
    0
    This is very cool. I just talked with another engine tech and he's going to bring in his Hydra from home to check this out with. We're trying to get together an entire VR rig with whatever hardware we can find to see if it's achievable (also it's fun).
    Twitch /unrealalexander| Twitter @UnrealAlexander
    How to report a bug? | Installation & Setup issues?
    Call me to a thread by posting this: [MENTION]Alexander Paschall[/MENTION]

  22. #22
    0
    A very cool plugin, but I get some error when loading it.

    Plugin 'HydraPlugin' failed to load because module 'HydraPlugin' could not be found.

    I've placed the Plugin folder in my project folder. The warning comes up after I enable the plugin just after the engine restarts.

    I'm using Windows but I have the same problem as the Mac user above.

  23. #23
    0
    Supporter
    Join Date
    May 2014
    Posts
    7
    Quote Originally Posted by Kashaar View Post
    This is pretty awesome! I just integrated Hydra support into a fresh template project and am happily moving around and rotating two gizmos with the hydras

    Would it be helpful to anyone if I released my HydraInputActor-derived blueprint that handles almost all the things?

    One thing I've noticed, Hydras rotation and joystick structs seem to be not directly mapped to UE4's... for example, Sixense's Pitch is UE's Yaw, Yaw is inverted Roll, and Roll is inverted Pitch. Though I'm not sure if this isn't maybe because of the project template and perspective I was using.
    That would be very helpfull, I'm making my own implementation right now for simulating hands for a future VR game. Still a bit buggy so I'm wondering what you have made!

    I've also noticed the mixing up of the rotation's pitch, roll and yaw for the rotation, would be nice if they could be converted in the plugin to UE4's yaw, roll and pitch.

  24. #24
    0
    Unreal Engine Support
    Join Date
    Apr 2014
    Posts
    168
    Great work on the plugin. I have brought in a Hydra I had at home that wasn't being used and it didn't take long to get some basic gameplay working with it. I look forward to seeing how you are able to keep improving on this.
    Last edited by Tim Lincoln; 05-14-2014 at 10:15 AM.
    Engine Support Technician

  25. #25

  26. #26
    0
    Quote Originally Posted by LoveTune View Post
    A very cool plugin, but I get some error when loading it.

    Plugin 'HydraPlugin' failed to load because module 'HydraPlugin' could not be found.

    I've placed the Plugin folder in my project folder. The warning comes up after I enable the plugin just after the engine restarts.

    I'm using Windows but I have the same problem as the Mac user above.
    Make sure you are using the correct version of the plugin for your engine version (0.5.1 for 4.1 and 0.5 for 4.0.x). Also is the engine being used in 64bit mode?

    Quote Originally Posted by Strykeforce View Post
    I've also noticed the mixing up of the rotation's pitch, roll and yaw for the rotation, would be nice if they could be converted in the plugin to UE4's yaw, roll and pitch.
    This will hopefully be fixed in the next version, it's on the todo list.

    Quote Originally Posted by Alexander Paschall View Post
    This is very cool. I just talked with another engine tech and he's going to bring in his Hydra from home to check this out with. We're trying to get together an entire VR rig with whatever hardware we can find to see if it's achievable (also it's fun).
    Quote Originally Posted by Tim Lincoln View Post
    Great work on the plugin. I have brought in a Hydra I had at home that wasn't being used and it didn't take long to get some basic gameplay working with it. I look forward to seeing how you are able to keep improving on this.
    Glad to see Unreal taking a strong interest in VR! If you have any suggestions on how to improve the plugin to fit epic style better, I'm all ears
    Last edited by getnamo; 05-14-2014 at 12:19 PM.

  27. #27
    0
    Unreal Engine Support
    Join Date
    Apr 2014
    Posts
    168
    Hi getnamo,

    I have not had an opportunity to look at the source code you have available with your plugin, but it would be a good idea to make sure your source code matches the coding standards used at Epic (if you have already done this, then please disregard ). You can see our current standards here.
    Engine Support Technician

  28. #28
    0
    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

  29. #29
    0
    Supporter
    Join Date
    May 2014
    Posts
    7
    @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)
    Last edited by Strykeforce; 05-16-2014 at 05:10 AM.

  30. #30
    0
    Quote Originally Posted by Strykeforce View Post
    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)
    You do realize that the source is included in the download, right?
    Broad Strokes | Jan Kaluza | Marketplace Release: 'Over 9000 Swords' Modular Melee Weapon System
    Currently available for freelance work
    Dev Blog & Tutorials | Twitter

  31. #31
    0
    Supporter
    Join Date
    May 2014
    Posts
    7
    Quote 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!

  32. #32
    0
    Quote 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.


    Quote 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 at 03:20 PM.

  33. #33
    0
    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 at 05:52 AM.

  34. #34
    0
    Supporter
    Join Date
    May 2014
    Posts
    7
    Quote 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/viewtopic.php?f=139&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/viewtopic.php?f=139&t=18265&start=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 at 03:06 PM.

  35. #35
    0
    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 Images Attached Images  
    Broad Strokes | Jan Kaluza | Marketplace Release: 'Over 9000 Swords' Modular Melee Weapon System
    Currently available for freelance work
    Dev Blog & Tutorials | Twitter

  36. #36
    0
    Supporter
    Join Date
    May 2014
    Posts
    7
    Quote 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 at 02:15 AM.

  37. #37
    0
    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.

  38. #38
    0
    Supporter
    Join Date
    May 2014
    Posts
    7
    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.

  39. #39
    0
    Quote 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 at 10:14 AM.

  40. #40
    0
    Supporter
    Join Date
    May 2014
    Posts
    7
    Quote 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!

Page 1 of 9 123 ... LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •