Warning : runtime navigation does not work in Unity 2018 and up ! New: - Navigation at runtime - Fixed drift on Mac SpaceNavigator driver for Unity3D
This driver lets you fly around your scene in the editor and allows you to move stuff around.
You can also use it at runtime via scripting.
Actually, the driver should work for all 3dconnexion products, but I’ve only been able to test it on the SpaceNavigator.
It has 4 modes: Fly, Orbit, Telekinesis and GrabMove
The default mode is Fly mode and when you’re flying around, this driver always keeps your horizon horizontal.
So you don’t have to worry about ending up upside down, just go where you want and get some work done.
In Orbit mode you orbit the current selection.
To move stuff around, you can use 2 modes: Telekinesis and GrabMove.
In Telekinesis mode, you can move the stuff you selected with the SpaceNavigator, while your camera stays put.
(this mode can be operated in Camera-, World-, Parent- and Local coordinates)
In GrabMove mode the stuff will be linked to your camera so you can take it with you and position it where you want.
Translation can be snapped to a grid.
Rotation can be angle-snapped.
Platform support
As of version 1.3, this driver supports both PC and Mac.
The driver supports both Unity Personal and Pro versions.
Caveat: when running Unity 4 and lower on Mac you need the Pro version because Free did not allow plugins.
Grab Mode only works in the camera coordinate system (sorry, I couldn’t get my head around the quaternion math of manipulating in one coordinate system while constraining in another)
Installation
Install 3DConnexion driver and make sure it is running
(avoid version 10.4.4, that one’s broken)
Import the unitypackage into your project
Open the SpaceNavigator window from the pull-down menu Window/SpaceNavigator (or hit Alt-S)
Fly away
Upgrading
When installing a newer version of the plugin, please follow these steps:
Close the SpaceNavigator editor window.
Delete the SpaceNavigator folder from your project.
Delete Plugins\3DConnexionWrapperU4.bundle from your project.
Import the new package.
Reopen the SpaceNavigator window (Alt-S).
If you delete the folder while the SpaceNavigator window is still open, Unity will throw some errors.
When this happens, choose the default layout from the layout dropdown in the top right of Unity’s UI and everything should return to normal.
Pro tip
Copy the SpaceNavigator unitypackage to Unity/Editor/Standard Packages directory.
SpaceNavigator is added to the packages list in the project creation in wizard.
Easy to add later by right-clicking in Project View and choosing Import Package.
Credits
Enrico Tuttobene for contributing the fix for the drifting on Mac.
Big thanks to Chase Cobb for motivating me to implement the Mac version.
Thanks to Manuela Maier and Dave Buchhoffer (@vsaitoo) for testing and development feedback.
Thanks to Ewoud Wijma for loaning me the Hackingtosh for building the Mac port.
Very nice package, thank you for providing this Can I put a request in to have an orbit object mode so we can rotate around the selected object, and could the right button be used to switch modes?
@SteveB
Thanks man, its been a long time coming indeed.
@SpookyCat
Orbiting wouldn’t make any sense in Telekinesis and GrabMove modes, so I added the option for orbiting only when in Fly mode.
Unfortunately I don’t know how to detect a right-mouse click, do you ?
The modifications were made in the development branch.
If you don’t want to check out the repo, here’s a unitypackage.
@SpookyCat Batigol
I tried to get the right button of the SpaceNavigator to toggle orbit mode, but for some reason the keyboard class’ IsKeyDown method will never return true.
I added a feature branch for this.
Bagitol, have you had SpaceNavigator buttons working in your experiments ?
@Hike1
Glad to hear you got it working in the end
I started the project to do navigation and I’ve implemented that to work in camera space, so that only makes sense in one viewport.
I’ve seen the horizon get crazy once, if you see it again, please try and reproduce the problem and describe it as clearly as possible. If I can reproduce it, I’ll be halfway there towards fixing it (hopefully).
Orbit mode was hacked in quickly at SpookyCat’s request, no options were added in the process. What settings are you missing ?
Have you made any progress? Been wanting to get a SpaceNavigator but the Unity support has been lacking. Would love to be able to support it at runtime, too. I’ve never written a device driver so I’m not sure what’s involved in getting it to work on mac.
First of all thanks a lot for this driver - really helpful!
A question though: I’m having a problem that after trying it at runtime. Basically I start Unity, press play, my player can move with the SpaceNav… I press Stop. When I press play again, my spacenav doesn’t work anymore. It doesn’t give any error or warnings( ie device disconnected). Any clue? Maybe after instancing a spacenav once, it can’t get reinitiated when the service has stopped?
The only way for now is closing and reopening Unity…if you could help with that I’d be glad! Thanks
@JTown: to get it to work at runtime, just call the SpaceNavigator class in your script to access its properties (i.e.: SpaceNavigator.Translation, SpaceNavigator.Rotation etc…)
Hey Akabane,
thanks for your interest in the driver and for reporting a bug!
I should have done a better job at testing runtime support…
I’ll have a look at it asap and report back.
At the moment I’m working on getting the driver to work without the need of having the editor window open.
This requires some restructuring, and (re)initialization is an important part of that.
I’ll take your bug into account while developing and testing the new version.
So if I can’t do a quick fix, it will be addressed properly in the next version for sure.
Thanks a lot!
I noticed the problem disappears if I keep the editor window open at all times, even at runtime. Still haven’t had the courage to try and do a build
Can’t wait for the fix/next version then! Any pointer on when you think it’ll be available?
Cheers
EDIT: Additionally, even if I saw it’s something you were playing around with, is there any known way to make it recognize the hardware buttons on the spacenav? I’m trying to modify the script to include sensor keyboard input, I’ll update if I can get anywhere…
EDIT2: Looks like the keyboard handling goes through an eventHandle in TDxInput.dll, so I can’t directly access the button presses - I’ll try to snatch up code here and there to see if I can patch something up…