Search Unity

SpaceNavigator driver [OpenSource]

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

  1. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Hi David, thanks for the heads up!
    I'll see if I can get this fixed.
    Don't have much spare time at the moment though, anybody know when this 5.4 thing is going to be released ???
     
  2. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Says "Depreciated" in the Asset Store Downloads, hoping for an update as well.
    Gladly pay $20 for an update.
     
  3. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    First, thank you for making this driver!

    I just got my first Space Navigator yesterday, mainly for using with Unity, and I'm having some trouble in 5.3.5.

    It works fine until it doesn't. When it stops working, it will then ONLY zoom in and out, and the only axis that works is the forward and back tilt. The switch over happens when I do anything in the scene view. Even just clicking in the scene view will cause it to stop working.

    Somewhere in this thread someone mentioned that it may be conflicting with another camera script, but I've tried it even in totally blank projects and still the same thing.
     
  4. aviationdoc

    aviationdoc

    Joined:
    May 26, 2016
    Posts:
    5
    Yes, unfortunately doesn't work in version 5.4 beta :-(
     
  5. aviationdoc

    aviationdoc

    Joined:
    May 26, 2016
    Posts:
    5
    Might be the new drivers actually from Connexions... hope not
     
  6. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    No idea. This is the first time I've used one of these things and I was really excited about using it for Unity dev.
     
  7. David-Shaw542

    David-Shaw542

    Joined:
    Feb 11, 2015
    Posts:
    5
    Mine now works in Beta's 24 and 25. I updated the drivers about 1 week ago.
     
  8. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Hi there, I've done some testing and the driver works in 5.4 beta 24.
    3DxWare version 10.4.4 is causing problems.
    I talked to 3DConnexion about it and they confirmed, the bug will be fixed in 10.4.5.
    Please use 10.4.3 for now.

    I actually posted this before, but that post got lost due to unity's forum fumbling...
     
    schmosef and Ony like this.
  9. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    Awesome! The older driver worked. Thanks again. :)
     
  10. aviationdoc

    aviationdoc

    Joined:
    May 26, 2016
    Posts:
    5
    Actually I had no luck with the older drivers....what procedure did you follow, Ony? I uninstalled current and installed the old ones, but had no luck getting the driver working Unity. I'm running Windows 10, maybe you're running a different OS?
     
  11. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    I'm running Windows 7/64, so yeah maybe there's a difference in drivers?
     
  12. aviationdoc

    aviationdoc

    Joined:
    May 26, 2016
    Posts:
    5
    Pat -- which OS are you running on?
     
  13. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    I'm also running Win10...
    Are the 3DConnexion demo's working properly on your machine ?
     
  14. aviationdoc

    aviationdoc

    Joined:
    May 26, 2016
    Posts:
    5
    Yup the demos work properly on my machine. 3DConnexion is a very hard company to reach. I've been trying all angles to find out when they'll release the 10.4.5 drivers and I get absolutely zero response. Have you heard anything?
     
  15. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Do you have any plans to add a Play mode interface?
     
  16. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    @aviationdoc they still haven't released 10.4.5 ? wow, they sure are taking their time :\ what a bummer
    I haven't spoken to them recently.

    @Elecman no plans, I thought that getting the pos/rot data out would be what people need
    what kind of play mode interface are you thinking of ?
     
  17. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Basically it is to control the camera like in Editor mode. But in Editor mode, the screen effects won't work, and the lighting is a bit different. I would like to make some youtube videos of fly-arounds but it has to be in Play mode for it to look good.
     
  18. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    You could write a little script and use SpaceNavigator.Translation / Rotation to move your ingame camera around.
    Check out the FlyAroud runtime sample.
    (don't forget to disable the runtime editor navigation checkbox)

    Also, I heard that Unity is working on getting screen effects to work in the editor view.
     
  19. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Thanks, I will have a play with that.
     
  20. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    The new drivers are available on the 3DConnexion site now.
     
  21. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Thanks for the heads up!
     
  22. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    Any way I can swap UP/DOWN for ZOOM IN/OUT? Currently IN = UP, OUT = DOWN. But I prefer to have it as In/Out are Zoom In/out, not Up/Down...
     
  23. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    When you download the package from the asset store, all source is included.
    You can open ViewportController.cs and swap some axis in the Fly, Orbit, etc. methods and adapt it to your liking.
    The benefits of open source software :)
     
  24. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    Love the open source, hate the work! :)
    Thanks for the info. I will play around withe script!!!
     
  25. ThomasVeil

    ThomasVeil

    Joined:
    Aug 7, 2014
    Posts:
    7
    Love the plugin - so crazy helpful in projects where I have to zoom in and out a lot.

    Though I have drifting issues. I'm using Unity 5.4.0 on PC. If I just import an (very heavy) asset into an empty scene, and then move around, the camera keeps moving a couple meters even after I stopped pushing the Navigator.
     
  26. sgsrules

    sgsrules

    Joined:
    Nov 11, 2013
    Posts:
    9
    Hi Pat,
    The plugin is not working on unity 5.5. The data returned by the sensor for both translation and rotation is zero. But it works perfectly on version 5.4. Everything initializes properly in 5.5 and there are no errors. I made a stripped down version using TDx.TDxInput and everything still returns zeros. Maybe it's because they switched the mono runtime to 3.5 on unity 5.5? I've been using a spaceNavigator on my own engine for the past 5 years using TDx.TDxInput running on .net 4.5 and It's worked fine. I even tried using the version of TDx.TDxInput that i use in my own engine (same version #) and it also return all zeros. Any Ideas?
     
  27. peteforde

    peteforde

    Joined:
    Apr 1, 2016
    Posts:
    20
    Hey Pat! I wanted to share a quick anecdote that probably won't be super interesting to anyone except you...

    I am primarily identified as a Mac developer but it's impossible to ignore that most/all VR development is happening on Windows so I've been spending more and more time on our team's VR machine, teaching myself Unity and hacking demos together. Suddenly I remembered: that cool 3D mouse thing that I bought that ended up being basically unusable on Mac.. maybe it would work on Unity! So I was disappointed to see nothing on the 3DConnexion site. I checked the asset store as a last-gasp effort, and here I am a week later, zipping around like a hummingbird. THANK YOU!

    I too am having the issue where it will be working (5.4.2f2) until precisely the moment it stops. I keep hoping to figure out a way to reinitialize the connection without restarting Unity. Having read the thread, I'm going to try leaving the dialog open as some have suggested.

    What I would like to know is how you're doing, after 3-4 years of frustrating work on this tool? Open source can be exhausting and thankless. Is there anything that we as a community can do for you?
     
  28. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Hi Pete,
    Thanks very much for your anecdote!
    Hearing tuff like that makes a project like this worthwhile.

    What would I like from the community?
    Well, there's two things that come to mind:
    • ideas that could improve the driver
    • actuate bug reports, "it doesn't work" is not much to go on. I'd love to see detailed steps on how to reproduce the problem + a description of the system (OS, unity version, 3dconnexion version).

    Greetings from the Maldives, hope to get some development time in again on this project when I get back from holiday.

    Ciao, Patrick
     
    Last edited: Dec 10, 2016
  29. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    Would it be possible to get the contoller to react to colliders in play mode (i.e. not sink into the terrain)?
     
  30. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    I'm not sure what you mean by "sink into the terrain".
    Check out the Fly Around scene in the Runtime Samples folder.
    In it, you control a sphere which interacts with other objects via physics.
    That sounds like what you're trying to achieve.
     
  31. Climber-fx

    Climber-fx

    Joined:
    Oct 21, 2015
    Posts:
    5
    Hey PatHightree. Thank you for this driver. I love it. Working almost perfectly here.
    The only thing is that is not holding my settings for speed, inverted axis and so one. Always coming back to default setting after a restart. I'm using iMac with Unity3d 5.5 and your 3dconnection space mouse driver 1.5.1, with 10.4.3 OS X driver for 3dconnection drivers. any solution/workaround? Thank you anyway!
     
  32. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    Yes, in the Fly Around Scene, you have a plane that acts floor where the cubes are sitting. However the sphere will go straight through the floor and other colliders that I have tried.
     
  33. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    AH, now I understand what you mean :)
    That's just a question of correcting the sphere position when it gets under the ground plane.

    Here's a version of FlyAround.cs that does this:
    Code (CSharp):
    1. using UnityEngine;
    2. using SpaceNavigatorDriver;
    3.  
    4. public class FlyAround : MonoBehaviour {
    5.     public bool HorizonLock = true;
    6.  
    7.     public void Update () {
    8.         transform.Translate(SpaceNavigator.Translation, Space.Self);
    9.         Vector3 pos = transform.position;
    10.         if (pos.y < 0.5f)
    11.             transform.position = new Vector3(pos.x, 0.5f, pos.z);
    12.  
    13.         if (HorizonLock) {
    14.             // This method keeps the horizon horizontal at all times.
    15.             // Perform azimuth in world coordinates.
    16.             transform.Rotate(Vector3.up, SpaceNavigator.Rotation.Yaw() * Mathf.Rad2Deg, Space.World);
    17.             // Perform pitch in local coordinates.
    18.             transform.Rotate(Vector3.right, SpaceNavigator.Rotation.Pitch() * Mathf.Rad2Deg, Space.Self);
    19.         }
    20.         else {
    21.             transform.Rotate(SpaceNavigator.Rotation.eulerAngles, Space.Self);
    22.         }
    23.     }
    24. }
     
  34. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Bug report:
    When no space navigator is plugged in, the scene camera resets to a zero position and orientation after starting then stopping play mode.

    One other thing. The dead zone seems to be much bigger then when used in 3ds Max. Adjusting the speed doesn't seem to make a difference.
     
  35. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    I have reproduced the pos/rot zero bug and am trying to find a solution for it.

    Are you on a Mac ?
    On Mac there was a problem with drift, so a deadzone was added.
    You can tweak the values of TranslationDeadzone and RotationDeadzone in SpaceNavigatorMac.cs
    If you tweak those variables and find better values, please let me know because I don't have a mac.
     
    Last edited: Jan 2, 2017
  36. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    I am on windows. Is there another way to fix the deadzone?

    By the way, how is the lobbying going to integrate this into Unity? I asked some staff once about this and they didn't seem to know what I was talking about:

    -Unity dev: you need to talk to the input team.
    -Input team: not our department.
    -Me: it is in the top 10 of the feedback site and it is not rocket science.
    -Unity: we make our own priorities.
    -Me: sigh.
     
    Last edited: Jan 3, 2017
  37. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Ah, on windows I did not add any deadzone inside the driver.
    So the most likely cause for it would be the per application configuration in the 3dconnexion driver.

    I fixed the camera's pos/rot being zeroed on play.
    I fixed settings not being retained between sessions.
    The asset store publishing portal is acting up, so I don't know when I'll be able to publish a new version.
    But I pushed those fixes to github, so you can get it there.

    Regarding integration into Unity, I haven't actively pursued this and they haven't reached out to me.
    I guess sadly, that the feedback site is a remnant of a bygone era.
     
  38. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    Version 1.5.2 has been submitted for review.

    Fixes:
    - Fixed sceneview camera pos/rot being reset on play/stop.
    - Settings are now saved immediately after any modification.
     
    Last edited: Jan 4, 2017
  39. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Thanks for the fix :)
     
  40. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    1.5.2 is now live on the asset store
     
  41. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    Yes, that works, but I am still having trouble flying through various colliders (eg walls).

    Thanks!
     
  42. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    A simple approach for that would be to keep a record of the previous position.
    Then set up an OnCollisionEnter handler, and when collsion happens, restore the previous position.
    It won't feel smooth, but it would keep the flying object from penetrating.
    If you want smoother, I would split the visible from the controlled object and connect them via a physics joint to allow them to separate.
     
  43. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    Would using RayCastHit be another possible solution? I.e. do a raycast right before you move to make sure you don't encounter a collider and then don't move if that is the case?
     
  44. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    That would work, it would be simmilar to the OnCollisionEnter method I described above.
    The result would be jerky, go ahead and try it.
     
  45. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    Is the anyway to accessthe settings (sensitivity etc.) from within UNity?
     
  46. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    No problem, Settings is a static class so you can access it from everywhere.
    Like this:
    float translationSensitivity = Settings.TransSens[Settings.CurrentGear];
     
  47. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    I had another look at the deadzone issue on Windows. There is a much larger deadzone in rotation when compared with 3ds Max and Autodesk Inventor. The deadzone in translation is the same though.

    I modified RotSensScale in SpaceNavigatorWindows but this had no effect but change the sensitivity. The deadzone remained the same.

    The application specific settings of the standalone driver app does not have a setting for deadzone, only sensitivity (which is not the same as deadzone).

    Is there any other way to fix this?

    Edit:
    Strangely enough, there is no rotational deadzone in play mode, only in edit mode...
     
    Last edited: Jan 27, 2017
  48. PatHightree

    PatHightree

    Joined:
    Aug 18, 2009
    Posts:
    297
    I'm sorry to say, on the windows side I haven't implemented any deadzone (there is on the mac version).
    So the deadzone is part of the 3dconnexion driver.
    The only thing I can think of is that I'm using a non-standard/recommended (polling) method of retrieving the data from the driver. (its the only way I have found that works inside unity)
    Maybe if I were using the standard way to communicate with the driver, the deadzone wouldn't be there.. I don't know.
     
  49. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Interesting. Anyway, it's just a small annoyance. Happy it works pretty well overall :)
     
  50. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    Thank you for this awesome plugin! It works perfectly on Windows 10 Unity 5.6.

    I've tried to get the _device.IsConnected status, but it seems to always return true, even when it is not plugged in. It would be nice with a public method that indicates if the Space Navigator is plugged in.