Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SpaceNavigator driver [OpenSource]

Discussion in 'Assets and Asset Store' started by PatHightree, May 15, 2013.

  1. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Thanks for sharing your experience with 5.6.
    It would definitely be nice to have an accurate device status, but I only report the data that I get from the driver... sorry
     
  2. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    That would work, it would be simmilar to the OnCollisionEnter method I described above.
    The result would be jerky, go ahead and try it.


    So,I finally got around to trying this and it does work. It is a bit jerky, but it works well enough and I havn't tried tweaking the setting, but I was very excited to see that the collisions worked at all. Basically, I took the "Don't Go Through Things" script and modified it. Snice Iam not a programmer, this is a total hack, but here it is:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using SpaceNavigatorDriver;
    4. public class FlyAround  : MonoBehaviour
    5. {
    6.        // Careful when setting this to true - it might cause double
    7.        // events to be fired - but it won't pass through the trigger
    8.        public bool sendTriggerMessage = false;    
    9.     public LayerMask layerMask = -1; //make sure we aren't in this layer
    10.     public float skinWidth = 0.1f; //probably doesn't need to be changed
    11.     private float minimumExtent;
    12.     private float partialExtent;
    13.     private float sqrMinimumExtent;
    14.     private Vector3 previousPosition;
    15.     private Rigidbody myRigidbody;
    16.     private Collider myCollider;
    17.     public bool HorizonLock = true;
    18.  
    19.     //initialize values
    20.     void Start()
    21.     {
    22.        myRigidbody = GetComponent<Rigidbody>();
    23.        myCollider = GetComponent<Collider>();
    24.        previousPosition = myRigidbody.position;
    25.        minimumExtent = Mathf.Min(Mathf.Min(myCollider.bounds.extents.x, myCollider.bounds.extents.y), myCollider.bounds.extents.z);
    26.        partialExtent = minimumExtent * (1.0f - skinWidth);
    27.        sqrMinimumExtent = minimumExtent * minimumExtent;
    28.     }
    29.     void FixedUpdate()
    30.     {
    31.    
    32.     // Added from FlyAround
    33.         transform.Translate(SpaceNavigator.Translation, Space.Self);
    34.            
    35.                 if (HorizonLock)
    36.                 {
    37.                     // This method keeps the horizon horizontal at all times.
    38.                     // Perform azimuth in world coordinates.
    39.                     transform.Rotate(Vector3.up, SpaceNavigator.Rotation.Yaw() * Mathf.Rad2Deg, Space.World);
    40.                     // Perform pitch in local coordinates.
    41.                     transform.Rotate(Vector3.right, SpaceNavigator.Rotation.Pitch() * Mathf.Rad2Deg, Space.Self);
    42.                 }
    43.                 else
    44.                 {
    45.                     transform.Rotate(SpaceNavigator.Rotation.eulerAngles, Space.Self);
    46.                 }
    47.                 // End add from FlyAround
    48.      
    49.        
    50.        //have we moved more than our minimum extent?
    51.        Vector3 movementThisStep = myRigidbody.position - previousPosition;
    52.        float movementSqrMagnitude = movementThisStep.sqrMagnitude;
    53.        if (movementSqrMagnitude > sqrMinimumExtent)
    54.         {
    55.           float movementMagnitude = Mathf.Sqrt(movementSqrMagnitude);
    56.           RaycastHit hitInfo;
    57.           //check for obstructions we might have missed
    58.           if (Physics.Raycast(previousPosition, movementThisStep, out hitInfo, movementMagnitude, layerMask.value))
    59.               {
    60.                  if (!hitInfo.collider)
    61.                      return;
    62.                  if (hitInfo.collider.isTrigger)
    63.                      hitInfo.collider.SendMessage("OnTriggerEnter", myCollider);
    64.                  if (!hitInfo.collider.isTrigger)
    65.                      myRigidbody.position = hitInfo.point - (movementThisStep / movementMagnitude) * partialExtent;
    66.               }
    67.            
    68.            
    69.        previousPosition = myRigidbody.position;
    70.     }
    71.    
    72.         }
    73. }
     
    Last edited: Apr 15, 2017
  3. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    950
    Getting an error on Windows 10, Unity 5.6 (64 bit).

    EDIT:
    Nevermind, had to install the driver. Figured it was already installed since it worked with Blender out of the box
     
    Last edited: May 16, 2017
  4. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Hehehe, sorry about your poor install experience.
    Please contact a support rep to receive a full refund ;)
     
    Don-Gray likes this.
  5. Chaoszerom

    Chaoszerom

    Joined:
    May 24, 2017
    Posts:
    5
    Hi there,

    Just wanted to confirm something, without digging in to the code too far. I'd like to use one of these at runtime to control, not a camera, but some property of the scene itself. Simply doing the required setup and accessing variables like SpaceNavigator.Rotation should work, right?
     
  6. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Yep, that's exactly how you'd do that.
     
  7. Hoogin

    Hoogin

    Joined:
    Jul 27, 2015
    Posts:
    38
    I couldn't get it to work in Linux. Does the PC part in "PC and Mac" include Linux?
     
  8. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    When I wrote this, there was no linux support in Unity.
    So if it would work it would be a magical coincidence.
    I have no linux knowledge, or ambition to develop linux support for the driver.
    Ofcourse the driver is open-source, so someone more at home in linux could give it a shot.
     
  9. Hoogin

    Hoogin

    Joined:
    Jul 27, 2015
    Posts:
    38
    Okay, I'll poke around a bit see if I can get something working.
     
  10. Hoogin

    Hoogin

    Joined:
    Jul 27, 2015
    Posts:
    38
    I managed to connect to the device using the opensource space navigator driver for linux.
    I copied most of the mac code to the added linux parts. It's partly working in unity. :)
    There is a few bugs to fix, cleaning up the code and some more testing to be done.
     
    AlessB and jaberwocky like this.
  11. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Just tried it and it works like a charm, absolutely AWESOME plugin!

    Thanks a lot for this, keep up the good work!
     
  12. Climber-fx

    Climber-fx

    Joined:
    Oct 21, 2015
    Posts:
    5
    Hey Pat.
    Is there a way to access the buttons of SpaceMouse 3D in unity editor and player (player standalone too)?
    I ask because i can't find any reference on the C# libraries from actual version.
    By the way, i love to have it working on Unity, so, thank you very much!

    Cheers!
     
  13. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Hey there,

    first, thanks for making that plugin. Works like a charm!

    I got two questions:
    1. values are not returned anymore when the Unity application is not in focus. There is a description online for how to fix that here, but I can't find the correct position inside your code, not sure if a custom dll would be needed.
    2. same as Climber-fx, would be great to be able to access buttons. Is there any progress on that?
    EDIT: after searching around for a while, there is a simple fix to the "not in focus" issue (but unfortunately it is computer-specific). Turns out that 3Dconnexion saves a file for each application (e.g. Unity) if you start changing any settings in their config tool. The file goes to %APPDATA%/3Dconnexion\3DxWare\Cfg and is called "Unity.exe.xml" (for the Unity editor). In this file, you can change the <CfgProperties> tag to include the following:
    Code (CSharp):
    1. <CfgProperties>
    2.     <InheritsFrom>STR_DEFAULT_S80</InheritsFrom>
    3.     <Grab>Hard</Grab>
    4.   </CfgProperties>
    The important thing here is <Grab>Hard</Grab>.

    That now should keep Unity (or your built executable) receiving the space navigator input.
     
    Last edited: Aug 23, 2017
  14. SagarPatel

    SagarPatel

    Joined:
    Jan 23, 2014
    Posts:
    3
    Hi Pat,

    First off, thanks so much for writing this plugin, it's been a joy to use!

    Just one little issue I've noticed though when looking at the Unity profiler: it seems like getting Translation and Rotation data generates a fair amount of garbage.
    For example in the sample Fly around scene, there's 7.1KB of garabage created every frame.

    I dug through the code and the core of the issue seems to be at the low level when retrieving Vector3D and AngleAxis from the Sensor class.
    Interesting to note though, getting the Period value doesn't seem to cause any garbage, probably because it's just a double value.

    I'm guessing if we could get the raw X,Y,Z etc values as double types instead of having to use the Vector3D/AngleAxis wrapper classes, we shouldn't have any garbage either. Unfortunately it doesn't look like there's an API for that at the moment?
    Is there something that could be done on your end of the plugin, or is it solely on 3DConnexion to update their dll to enable it?

    Thanks!
     
  15. benbucksch

    benbucksch

    Joined:
    Nov 26, 2017
    Posts:
    3
    Hello Pat,

    first thanks for writing this plugin.

    Unfortunately, it's not working for me. I am using Unity 2017.02 on Windows 10.
    SpaceNavigator appears to be correctly recognized in the Windows "Devices" settings panel, with a special UI for SpaceNavigator. I know no other way to verify that the device works.

    I installed your plugin, imported it into my project, and restarted Unity.

    I see the following error on the Console:
    Code (csharp):
    1. System.Runtime.InteropServices.COMException (0x80040154):
    2.   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (Int32 errorCode) [0x0000d] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs:1031
    3.   at System.__ComObject.Initialize (System.Type t) [0x0007d] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/__ComObject.cs:103
    4.   at (wrapper remoting-invoke-with-check) System.__ComObject:Initialize (System.Type)
    5.   at Mono.Interop.ComInteropProxy.CreateProxy (System.Type t) [0x00007] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs:108
    6.   at System.Runtime.Remoting.RemotingServices.CreateClientProxyForComInterop (System.Type type) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs:588
    7.   at System.Runtime.Remoting.Activation.ActivationServices.CreateProxyForType (System.Type type) [0x00047] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Remoting.Activation/ActivationServices.cs:234
    8.   at <0x00000> <unknown method>
    9.   at SpaceNavigatorDriver.SpaceNavigatorWindows..ctor () [0x00015] in Test\Assets\SpaceNavigator\Plugins\SpaceNavigatorWindows.cs:48
    10. UnityEngine.Debug:LogError(Object)
    11. SpaceNavigatorDriver.SpaceNavigatorWindows:.ctor() (at Assets/SpaceNavigator/Plugins/SpaceNavigatorWindows.cs:56)
    12. SpaceNavigatorDriver.SpaceNavigatorWindows:get_SubInstance() (at Assets/SpaceNavigator/Plugins/SpaceNavigatorWindows.cs:61)
    13. SpaceNavigatorDriver.SpaceNavigator:get_Instance() (at Assets/SpaceNavigator/Plugins/SpaceNavigator.cs:37)
    14. SpaceNavigatorDriver.SpaceNavigator:get_Translation() (at Assets/SpaceNavigator/Plugins/SpaceNavigator.cs:13)
    15. SpaceNavigatorDriver.ViewportController:Update() (at Assets/SpaceNavigator/Editor/ViewportController.cs:72)
    16. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    SpaceNavigatorWindows.cs:48 is:
    Code (csharp):
    1. _device = new DeviceClass();
    Context:
    Code (csharp):
    1.        private SpaceNavigatorWindows() {
    2.            try {
    3.                if (_device == null) {
    4.                    _device = new DeviceClass();
    5.                    _sensor = _device.Sensor;
    6.                    //_keyboard = _device.Keyboard;
    7.                }
    8.                if (!_device.IsConnected)
    9.                    _device.Connect();
    10.            }
    11.            catch (COMException ex) {
    12.                Debug.LogError(ex.ToString());
    Not surprisingly, nothing works, Unity does not react to any input from the device.
     
    Last edited: Nov 26, 2017
  16. benbucksch

    benbucksch

    Joined:
    Nov 26, 2017
    Posts:
    3
    Given that Windows had clearly recognized the SpaceNavigator with special UI from 3Dconnexion, I assumed that the driver was working. I didn't know that installing 3DxWare was required.

    Pat, could you maybe mention that on the install page? It does say "install SpaceConnection driver", and I did read that, but I thought that Windows 10 had it built-in, and that it was already running, given the above. It would be nice to be specific that we also need the 3DxWare bloat ware.

    Do you think we could make a nicer error message, too? The cryptic error message suggested a bug in the extension. An error message with some suggestions what the cause might be and how to fix it would be nice: "SpaceNavigator not found. 1) Did you install 3DxWare and is it running? After install, restart Unity. 2) Is the device connected? Does it work in 3DxTrainer?".

    Restarting Unity after 3DxWare installation was required for it to work correctly, even though Unity said "Joystick connected" even before restart. Without restart, only some dimensions worked, and that with big jumps, and with stutter. I guess Unity sees it as regular joystick and your plugin didn't kick in yet. After restart of Unity, it worked.

    It runs great - smooth as butter! This is fantastic, thank you! I had the SpaceNavigator for many years (I think almost 10 years?), but I had never been able to use it properly. You made the thing useful for me. Many thanks.

    I'm going to send you a bit money http://bit.ly/12zimqq
    (Update: The bit.ly URL hardcodes NL as locale and country for Paypal. Given that I don't understand Dutch, I manually changed the URL in my browser.)

    Now, I just have to add it to my Unity game at runtime :)
     
    Last edited: Dec 1, 2017
  17. benbucksch

    benbucksch

    Joined:
    Nov 26, 2017
    Posts:
    3
    Here's an only half tested patch to add the error message:
    Code (csharp):
    1. diff --git a/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorMac.cs b/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorMac.cs
    2. index 82011a1..2dc5127 100644
    3. --- a/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorMac.cs
    4. +++ b/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorMac.cs
    5. @@ -71,10 +71,20 @@ namespace SpaceNavigatorDriver {
    6.              try {
    7.                  _clientID = InitDevice();
    8.              }
    9.              catch (Exception ex) {
    10.                  Debug.LogError(ex.ToString());
    11. +#if UNITY_EDITOR_OSX
    12. +               UnityEditor.EditorUtility.DisplayDialog("Device not found",
    13. +               "SpaceNavigator device not found.\n" +
    14. +               "1) Did you install 3DxWare and is it running? After install, restart Unity.\n" +
    15. +               "2) Is the device connected? Does it work in 3DxTrainer?\n\n" +
    16. +               ex.ToString(),
    17. +               "Understood", "Dismiss");
    18. +#else
    19. +               // TODO Handle error in-game
    20. +#endif
    21.              }
    22.          }
    23.          public static SpaceNavigatorMac SubInstance {
    24.              get { return _subInstance ?? (_subInstance = new SpaceNavigatorMac()); }
    25. diff --git a/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorWindows.cs b/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorWindows.cs
    26. index 9cf2bb4..603ae8a 100644
    27. --- a/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorWindows.cs
    28. +++ b/Space Navigator Unity project/Assets/SpaceNavigator/Plugins/SpaceNavigatorWindows.cs
    29. @@ -52,12 +52,22 @@ namespace SpaceNavigatorDriver {
    30.                  if (!_device.IsConnected)
    31.                      _device.Connect();
    32.              }
    33.              catch (COMException ex) {
    34.                  Debug.LogError(ex.ToString());
    35. -           }
    36. -       }
    37. +#if UNITY_EDITOR_WIN
    38. +               UnityEditor.EditorUtility.DisplayDialog("Device not found",
    39. +               "SpaceNavigator device not found.\n" +
    40. +               "1) Did you install 3DxWare and is it running? After install, restart Unity.\n" +
    41. +               "2) Is the device connected? Does it work in 3DxTrainer?\n\n" +
    42. +               ex.ToString(),
    43. +               "Understood", "Dismiss");
    44. +#else
    45. +               // TODO Handle error in-game
    46. +#endif
    47. +            }
    48. +        }
    49.          public static SpaceNavigatorWindows SubInstance {
    50.              get { return _subInstance ?? (_subInstance = new SpaceNavigatorWindows()); }
    51.          }
    52.          private static SpaceNavigatorWindows _subInstance;
     
    Last edited: Nov 26, 2017
  18. BenTristem

    BenTristem

    Joined:
    Jul 11, 2014
    Posts:
    7
    Thank you so much for making this!

    I'm on a Mac and I cannot translate right. Could you either fix, or alternatively I'll do a fix and create a pull request on GitHub. Which would you prefer?
     
  19. mysunnytime

    mysunnytime

    Joined:
    Jul 18, 2016
    Posts:
    7
    Hi Patrick! I was trying to use the space pilot pro in unity using your interfaces (thanks for providing that, makes it way easier!) It worked fine last week, but today I found only the translation works and the rotation does not work at all in any of the scene that I used space navigator.

    I tested the space pilot pro with its own tutorial, it worked fine.

    Do you know what may be the problem?

     
  20. mysunnytime

    mysunnytime

    Joined:
    Jul 18, 2016
    Posts:
    7
    Also, I opened the space navigator window and saw the sensitivity options. But when I change the settings, there's no change. Do you know what's wrong with it, or how can I test whether the setting was properly applied (say, let me print some properties by script)?

    Thanks in advance.

     
  21. RavenLiquid

    RavenLiquid

    Joined:
    May 5, 2015
    Posts:
    44
    Hi, did you check if you didn't accidentaly lock rotation for Unity? The 3DXWare software remembers everything per application. If you have the Function keys LCD appeltrunning you should see in the top left corner if any are locked.

    I also created an editor script to extend the Space Navigator driver with shortcuts and mapped these in 3DXWare to be able to use the extra buttons. Now I can use the right view buttons to do the same as the viewport gizmo does. All the views plus switch between isometric and perspective. The roll buttons rotate the view left/right.
    I've mapped the left number keys to switch the modes, so I can switch between fly, orbit, telekinesis and grab move with just a key press and mapped the fit button to Focus (the F key feature).

    If anyone is interested I could post the scripts and 3DXWare files here. It's pretty rudimentary, just some hardcoded short cuts and a mapping in 3DXWare but it makes things a lot easier.

    I just wish they implemented the alt functions(blue text) as a key modifier (like FN) instead of longpress but it works.
     
  22. LeifBloomquistMDA1

    LeifBloomquistMDA1

    Joined:
    Sep 21, 2017
    Posts:
    2
    The SpaceNavigator plugin is great...but has suddenly stopped working for me!

    It simply does not work in Unity at all any more. I can't navigate in the Editor window, none of the example projects work ("Fly around", etc) do anything. The device works fine in all other applications.

    It used to work fine, though I do recall some occasional weirdness where I had to restart Unity.

    Details...

    Device: SpaceMouse Wireless
    OS: Windows 7 64-bit
    Unity: 2017.4.1f1
    3DxWare 10.5.6
    3DxWinCode 17.5.6.14829

    No errors in the console.

    Any suggestions? Thanks!
     
  23. PrawnJeremy

    PrawnJeremy

    Joined:
    Aug 20, 2013
    Posts:
    35
    I've had problems with newer drivers too. Try 3DxWare 10.4.10
     
  24. LeifBloomquistMDA1

    LeifBloomquistMDA1

    Joined:
    Sep 21, 2017
    Posts:
    2
    That was indeed the issue. Thanks. (Though reverting to an old version was a huge pain!)

    Does anyone know, if there a plan for support of new driver versions going forward?
     
  25. Janoshx

    Janoshx

    Joined:
    Dec 18, 2014
    Posts:
    4
    Hi

    This does not work with unity 2018.1.0f2. I have 10.5.7 version of the 3d connexion driver. Works in unity 2017.xx perfectly.
     
  26. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Read the last couple of posts, sounds like the new 3dconnexion drivers are not playing nice.
     
  27. Janoshx

    Janoshx

    Joined:
    Dec 18, 2014
    Posts:
    4
    space mouse works with unity 2018 with 3D connexion driver version 10.5.3. Also maya 2018.2 works.
     
    Last edited: Jun 8, 2018
  28. Jayws

    Jayws

    Joined:
    Sep 7, 2017
    Posts:
    4
    I'm trying to use SpaceMouse to control VR camera for a Vive device. The demo scene works in 2D (but not for VR), and so far, I've not been able to drag-drop any of the This packages scripts onto my VR Camera (complains that they are abstract) and the "Smooth Follow 2" script doesn't seem to control my camera regardless of what I use for the target. Hoping that someone who has made this work in VR can give me a hint? (At the moment I am using VRTK ,but could also set it up for SteamVR if that would make things easier.)

    I regularly write scripts that manipulate VR Camera of player for position or rotation, but I don't even see where I can get my mits on a spacemouse values for position, rotation, transform or quaternian based on the sample scene and script.

    Thanks
    -Jay-
     
  29. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    You're looking at the wrong script.
    FlyAround.cs does what you want.
     
  30. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I haven't used my 3D Mouse for a while but I just realised that I'm working on a scene where it would improve my productivity.

    I'm running all the latest software and drivers and it seems to be working for me.

    @PatHightree, Thanks again for providing this free asset for Unity.

    OS: Windows 10x64 build 1803
    Unity: 2018.2.2f1
    3DConnexion Driver: 10.5.10 x64
    Device: SpaceNavigator FW: 4.35
    Asset Store Plugin: 1.5.2
     
  31. atlas_r

    atlas_r

    Joined:
    Feb 15, 2016
    Posts:
    6
    @PatHightree, thank you for this amazing free asset. When using telekinesis to move my objects around, Unity's undo function won't undo my object transform changes. Is this expected behavior? I'm on Unity 2018.2.16.
     
  32. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    I just had a look at my bug list and yes, telekinesis undo is on there.
    So it's not unity-version related.
     
  33. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Can you please let me know how the sensitivity works? I am very frustrated with the Unity editor camera movements being far too large. Can I use this asset and a 3DConnexion to move the camera in very small amounts (hundreths of a unity unit) ?
     
  34. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    upload_2019-1-3_0-15-9.png
    The sensitivity works as follows:
    1st column shows the current slider value
    2nd column is the slider minimum value
    3rd column is the slider maximum value
    Huge/Human/Minuscule radiobuttons act as presets for the sensitivity sliders, so you can work at different sensitivity settings when working at different scale in your project.

    So for your use-case, the minuscule preset would be a good start.
    If it is not sensitive enough, decrease the numbers in the 2nd and 3rd columns and find the optimal sensitivity with the slider.
     
    Innovine likes this.
  35. tufeixp

    tufeixp

    Joined:
    Sep 6, 2015
    Posts:
    22
    It does not work in windows il2cpp compile mode, any plan to support it?
     
  36. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    No, not planned. I don't have any use for it.
     
  37. ebgenius

    ebgenius

    Joined:
    Feb 2, 2019
    Posts:
    1
    Hello @PatHightree,

    thank you very much for your work!
    I am using your driver now on Win10 and Unity 2018.3 with SpaceMouse Pro and 3DxWare 10.5 for some robotics work and it is working amazingly.

    I just wanted to point out this warning message I get every time, because I could not find anybody talking about it on here or your repository:
    Assets\SpaceNavigator\Editor\ViewportController.cs(31,4): warning CS0618: 'EditorApplication.playmodeStateChanged' is obsolete: 'Use EditorApplication.playModeStateChanged and/or EditorApplication.pauseStateChanged'

    Do you plan to change how your driver switches between play mode states to solve this?
    I've just started on Unity, so I don't know how to be more helpful about this.

    Thanks
     
  38. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Hi there,
    As a matter of fact, I got a pull request with a fix for that some time ago.
    It is merged into the master branch of the github repo.
    It's just not included in the asset store version.

    I tried to build a new asset store bundle, but I'm running into a lot of errors :(
    So, please give the github version a go.
    Otherwise, you can find an updated 1.5.3 unitypackage in my Google Drive.
     
    Last edited: Mar 7, 2019
    ebgenius, cecarlsen and schmosef like this.
  39. Anas173

    Anas173

    Joined:
    Feb 13, 2016
    Posts:
    2
    Hi @PatHightree Im using your asset and everything is working fine inside the unity Editor, however nothing is working on build. I checked the log file and it says


    Code (CSharp):
    1.  
    2. NotSupportedException: Specified method is not supported.
    3.   at (wrapper cominterop) TDx.TDxInput.DeviceClass..ctor()
    4.   at SpaceNavigatorDriver.SpaceNavigatorWindows..ctor () [0x0000e] in <8f81d57bc9b746c2b0fd853f9a914cc2>:0
    5.   at SpaceNavigatorDriver.SpaceNavigatorWindows.get_SubInstance () [0x00009] in <8f81d57bc9b746c2b0fd853f9a914cc2>:0
    6.   at SpaceNavigatorDriver.SpaceNavigator.get_Instance () [0x00007] in <8f81d57bc9b746c2b0fd853f9a914cc2>:0
    7.   at SpaceNavigatorDriver.SpaceNavigator.get_Translation () [0x00000] in <8f81d57bc9b746c2b0fd853f9a914cc2>:0
    8.   at FlyAround.Update () [0x00020] in <8f81d57bc9b746c2b0fd853f9a914cc2>:0
    Could you please assist me? Thank you
     
  40. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    858
    Oh no! I can confirm I have the same issue on Windows. I was planning to use the plugin for a AV performance next week.
     
  41. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    858
    I found this app that can be used for a temporary workaround. It was committed four years ago but luckily it still works.
    https://github.com/ETCLabs/OSCSpaceMouse

    Meanwhile I am hoping @PatHightree is kind enough to fix it. Pat, I just bought you a pizza. Everyone, remember you can donate here:
    http://bit.ly/12zimqq

    EDIT.
    Hit a wall again. OSCSpaceMouse only works when the app window is focused. That leaves me with two options: 1) running OSCSpaceMouse on a second Windows machine, or 2) use Osculator on a second MacOS machine =(
     
    Last edited: Mar 22, 2019
  42. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    858
    AHA! When I switch the Scripting Runtime Version to the deprecated .NET 3.5 version then I can export working Windows builds. I should have looked at the assemply info for TDx.TDxInput; it even states that it targets .NET 3.5.

    Unfortunately, I'm relying on a whole bunch of code that needs .NET 4.0 =(

    I wonder what it would take to recompile it for .NET 4.0.

    EDIT:
    I just tried building my own SpaceNavigatorOverOSC app using the 3.5 plugin, but similarly to OSCSpaceMouse it will only send when the app window is focused. So, useless.

    EDIT2:
    Forgot to mention, I'm on Unity 2018.3.7.

    EDIT3:
    I see that the TDx.TDInput.dll may be out of Pat's hands. So I've asked on the 3D Connexion developer forum if they could perhaps update their DLL.
     
    Last edited: Mar 23, 2019
  43. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    The problem that Anas173 points out is the same I ran into when I tried to build a new package for the asset store.
    So the assembly I'm using isn't compatible with newer .net versions, that's useful information.
    I researched an alternative approach using a windows hook and doesn't use a dll, but that's windows-only afaik :(
    Not sure if that method works when the window doesn't have focus though.
    Another problem is mac support.
    I don't have a mac to develop on and a rusty memory of how I implemented that code back then.
    Frankly I don't have not much motivation to dive into an unfamiliar ecosystem to fix arcane platform-specific problems.
    Maybe somebody with mac knowledge can help out here.
     
    cecarlsen likes this.
  44. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    858
    For my purposes that would be enough. As a (hopefully temporary) workaround, I have gone as far as buying an extra windows laptop with the sole purpose of grabbing the SpaceNavigator input and forwarding it to my .NET 4.0 build.
     
  45. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    858
    I got an answer from 3D Connexion:

     
  46. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Recent is a relative term, the latest version of Windows 3DxWare SDK is 3.4.0 which dates from 2018/03/09
    That sample is part of my windows hook research I mentioned before.
    The principle works, but I have no idea how it would work on a Mac.
     
  47. th3flyboy

    th3flyboy

    Joined:
    May 28, 2016
    Posts:
    9
    No idea, but if it's broken, maybe update to the new driver functionality?
     
  48. ealbuquerque

    ealbuquerque

    Joined:
    Jan 18, 2017
    Posts:
    7
    Hi,

    Thanks for the plugin!

    I downloaded it one week ago for a project I'm developing and it was working fine. But after having the Windows 10 updated yesterday, the Unity driver stopped getting the rotations input in both editor and game window. Translation is still working fine.

    EDIT: The space mouse works normally when using the demo application from 3dConnexion software. The problem only happens in Unity.

    I'm using Windows 10 64bit and Unity 2018.0f3.

    Anyone has any idea of what is going on?

    Thanks
     
    Last edited: Apr 3, 2019
  49. ealbuquerque

    ealbuquerque

    Joined:
    Jan 18, 2017
    Posts:
    7
    Fixed.
    After opening the Spacemouse's menu and going in advanced settings, I discovered that, for some reason, the rotations axes were disabled for Unity.
     
  50. ealbuquerque

    ealbuquerque

    Joined:
    Jan 18, 2017
    Posts:
    7
    Any news on how to make the build work on Windows environment? I'm very interested. I'm trying some solutions. I'll update here if anything works.