SpaceNavigator driver for Unity3D [Open Source]

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

SpaceNavigator driver for Unity3D [Open Source]

Post by Hightree »

Hi there,
I've released my Unity3D driver for the SpaceNavigator, the details and download links are here on the Unity3D forum.
The source is available on Github.
You can use the driver while working in the editor and also at runtime for use in productions.
It works in both Unity Indy and Pro, but for now it is only available on Windows.
Hit any user to continue.
Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by Hightree »

The driver is now available on the Unity Asset Store.
Actually, the driver should work for all 3dconnexion products, but I've only been able to test it on the SpaceNavigator.

Here's the readme:
SpaceNavigator driver for Unity3D

This driver lets you fly around your scene and allows you to move stuff around.
You can also use it at runtime via scripting.

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.
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 and rotation can be angle-snapped.

Platform support
The driver supports Unity 3 and 4, both Indie and Pro versions.
At the moment it is windows-only, but the code is right here https://github.com/PatHightree/SpaceNavigator.
Who knows, somebody with a mac might just step in and code the mac implementation.
I've prepared the code to make this as painless as possible, just subclass the SpaceNavigator class.

The goods
- SpaceNavigator + DemoScenes.unitypackage http://u3d.as/51X
Import this package into an empty project and play around.
  • Fly around.unity: Fly around with a sphere while knocking over some cubes.
  • Folow curve.unity: Make your torus follow the curve, but don't touch it!
- SpaceNavigator.unitypackage http://bit.ly/11wCvSY
Package without samples, import this package into your project and get to work.
- Source code on Github https://github.com/PatHightree/SpaceNavigator

Known bugs and limitations
- No mac support
- 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
- Connect the SpaceNavigator
- Install 3DConnexion driver http://www.3dconnexion.com/service/drivers.html and make sure it is running
- Import the unitypackage into your project
- Open the SpaceNavigator window from the pull-down menu Window/SpaceNavigator (or hit Alt-S)
IMPORTANT The editor window has to be opened for the driver to work !
- Fly away

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
- Big thanks to Dave Buchhoffer (@vsaitoo) for testing and development feedback
- Quaternion math by Minahito http://sunday-lab.blogspot.nl/2008/04/g ... rnion.html
Hit any user to continue.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by jwick »

Fantastic!
adekrom
Posts: 8
Joined: Sun Apr 20, 2008 11:58 pm

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by adekrom »

Great !
Works also for 3D Explorer USB.
Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by Hightree »

Thanks for confirming that :)
Hit any user to continue.
adekrom
Posts: 8
Joined: Sun Apr 20, 2008 11:58 pm

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by adekrom »

3D Connexion should make a deal with you :)
Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by Hightree »

Hehehehe, funny you should mention that.
Last week I got a mail from them, telling me they are sending me a SpaceMouse Pro :D
Hit any user to continue.
adekrom
Posts: 8
Joined: Sun Apr 20, 2008 11:58 pm

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by adekrom »

That's nice, so you will add functionality ?

I have to mention that the 2D Lock button (pan only) on the Space-explorer also worked in Fly mode.....
Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by Hightree »

Yes, I am currently working to remove the need for the editor window to be open.
Also, there's some bugs that I want to fix regarding runtime usage.

My SpaceNavigator doesn't have a 2D lock button, but I suspect that its function is handled by the 3dconnexion windows driver.
Glad to hear that it worked as you expected.
Hit any user to continue.
adekrom
Posts: 8
Joined: Sun Apr 20, 2008 11:58 pm

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by adekrom »

It would be nice to have a Orbit-Mode.
Select object -> Orbit around object's pivot. (as in CAD programs & Max & Maya).
Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by Hightree »

That has been requested before and I've got this working in a development branch.
If you're feeling adventurous, you can get it here: https://github.com/PatHightree/SpaceNav ... ee/develop
It will most likely be included in the next update, but it needs more testing on how it interacts UI-wise with the rest of the plugin.
Hit any user to continue.
adekrom
Posts: 8
Joined: Sun Apr 20, 2008 11:58 pm

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by adekrom »

Ok, thanks....
Several
Posts: 1
Joined: Sat Sep 28, 2013 11:22 am

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by Several »

I just got a SpaceNavigator, and I'm trying to get a broad view of what would be necessary to add OSX support to this project. I haven't really attempted anything like this before, so I'm kinda starting from zero (with some C# & C++ experience, I guess).

These are the steps & questions I've pieced together so far. If any of this is wrong, please correct me. If you can answer any of the questions, please do.

Step 1. Register & get the SDK via http://www.3dconnexion.com/service/soft ... loper.html
--This apparently requires registration & a license agreement, which bring up two questions:
a) Do I just fill out "Unity" as "my application" (which it isn't -- I'm just a Unity user) in the developer registration form?
b) What counts as legal use and what is not legal use of the SDK for adding mac support? (If there's already something I can use as a Unity "plugin" to read input, can I just copy it, if it'll be hosted on github?)

Step 2. Dig through SDK, docs, & examples enough to get a sense of what I need to do to get Unity to see/hear the SpaceNavigator.

Step 3. Use the SDK in conjunction with XCode to build a Unity "plugin" (according to: http://docs.unity3d.com/Documentation/M ... sktop.html) to perform the same function that the TDX.dll does for SpaceNavigatorWindows.cs (i.e. offer Device, DeviceClass, and Sensor?).
(Unless the SDK already includes the appropriate file(s), and it's legal to put them on github.)

Step 4. Create a C# script for Unity that imports this plugin, and subclasses SpaceNavigator in more or less the same manner that SpaceNavigatorWindows does (unless the mac SDK differs significantly).

Step 5. Get the C# script & plugin to Hightree (via pull request in github, if necessary).


For the moment, I've stopped at the Developer Registration form, as it doesn't seem appropriate to what I'm doing (i.e. just figure out what it'd take to add Mac support to someone else's plugin for an application I'm unaffiliated with), and the legal specifics seem fuzzy (what from the SDK is okay put on github). I'd like more information before advancing.

Thanks!
arigone
Posts: 1
Joined: Fri Oct 04, 2013 7:14 pm

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by arigone »

Look at this link,

https://www.assetstore.unity3d.com/#/content/9774

I found the results satisfactory, just missed being able to release the horizon, (would be perfect).

Best regards for all.
Hightree
Posts: 20
Joined: Fri May 11, 2007 1:09 am

Re: SpaceNavigator driver for Unity3D [Open Source]

Post by Hightree »

@Several
Sorry for the late reply, I was on holliday :)
I wouldn't sweat the legalese on the sdk submission.
3DConnexion are providing us developers with tools to increase the reach of their products, they want you to use their stuff.
Also, the driver architecture is two-tiered, the end user installs the 3DConnexion driver (which communicates with the device itself and contains most of the proprietary stuff) and us developers code a driver that communicates with their driver. These two can communicate via a couple of inter-process communication mechanisms.

@arigone
I've added toggling of horizon locking to the todo list.
Hit any user to continue.
Post Reply