Originally posted by Kashaar
View Post
Announcement
Collapse
No announcement yet.
Razer Hydra Plugin
Collapse
X
-
Originally posted by LoveTune View PostHi 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
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)
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-ue4Last edited by getnamo; 05-16-2014, 03:20 PM.
Comment
-
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.
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 lotLast edited by LoveTune; 05-17-2014, 05:52 AM.
Comment
-
Originally posted by getnamo View PostJust 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
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]);
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 anglesLast edited by Strykeforce; 05-19-2014, 03:06 PM.
Comment
-
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.Broad Strokes | Jan Kaluza | Marketplace Release: 'Over 9000 Swords' Modular Melee Weapon System
Currently not available for freelance work
Dev Blog & Tutorials | Twitter
Comment
-
Originally posted by Kashaar View PostWell, 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.
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
-
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
-
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
-
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]);
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
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.
Comment
-
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.
Comment
-
@Uni Koblenz &Originally posted by Mrob76u View PostNot being a programmer myself would some kind person please upgrade this awesome plugin to 4.2. Thanks very much
@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.
Comment
Comment