Support for Space Navigator 3D Mouse?

Are there people controlling games with a 3d mouse? Never heard of this. But if it works, why not. Not relevant to me personally, totally fine if the 3d mouse would just work to navigate the viewport. Don’t care one bit how hacky it is either :smiley:

I play Elite Dangerous with my Space Navigator - using Sx2vJoy + vJoy to map the axes to the game’s (very configurable) inputs. :smiley:

One strange thing I found - if I return “true” in ProcessMessage, strange things happen in UE4 Editor - tooltips and informational messages (like progress of building lights) become black blobs on the screen. If I return false everything is fine!

Make sure you only return true if you processed the message, i.e. the message was intended for your code, and nobody else should get it. If you always return true then you might be filtering messages that are important to other parts of the Engine :slight_smile:

You’re right - the event check is supposed to return false if wrong event, otherwise true. Fixed.

Ok, here is very rough source code for primitive support of the Space Navigator. Buttons don’t do anything, and range of the axes is assumed to be between -2048 to 2047 before being normalized, because that is what mine tracks to when I run the example program from the 3DxWare SDK. To compile you need the 3DxWare SDK, where the Inc and Lib directories must be placed in the ThirdParty directory of the Engine source code (for example, on my system it is in K:\UT4SrcCleanMaster\Engine\Source\ThirdParty\3DxWare).

I could not successfully make a binary plugin yet - I tried compiling it with Unreal Engine 4.10.1 source code, but I kept getting DLL errors when I use the official release - likely related to not uising Visual Studio 2015 to compile it - I only have Visual Studio 2013 at the moment. Maybe you guys will have better luck! Also, I am 99% sure that Shutdown/unloading of the module is not done correctly - I wouldn’t use this in shipping code until this is fixed. :stuck_out_tongue:

Oh - don’t forget to create the directory in your plugins folder - the repository isn’t quite set up properly - I’m new to Git, coming from Mercurial, so it’s still pretty foreign to me setting it up.

https://.com//

By the way, this should work in games too, just for the heck of it!

You can do what you want with the source, no strings attached. You just need to apply for the free 3DxWare SDK from the 3DConnexion website!

Good luck!

Ok, I managed to get VS 2015 installed and compiled the plugin for Unreal Engine 4.10.1. You can get it here - compiled for Win64 only:

Don’t forget to enable the plugin in your project! fingers crossed

Let me know how it works!

Cool! Although it seems it’s not working for me on 4.10.1, i get a “missing or incompatible modules in plugin” message when opening some random project.

Does the Editor log say which modules are missing? Also, is the 3DxWare drivers installed already?

I guess you could post the log into pastebin and I can have a look.

I updated the zip file in the dropbox link. Maybe it’ll fix it?

The DLL inside the zip should be a size of 138,240 bytes if it is the new one.

I hope your browser doesn’t cache the old one. That’ll suck.

Oh, that did actually fix it. Was just about to post the issue from the log

Works fine now, thanks! Good work too. Only issue for me is the way I usually used the mouse in 3D apps is by having it rotate around selected objects. That would be a nice feature for sure. Like what ALT-Mouse drag does I guess. Other than that it feels a bit slow, especially rotation but that’s just preference obviously.

Also trying to integrate into the engine source, getting compilation errors that si.h in SpaceNav3DPrivatePCH.h is missing even though I do have the libraries in the correct third party folder it seems. Surely something basic I’m missing.

If I up the speed in the driver to the max like so

a funny thing happens where motions are suddenly reversed at some point. :slight_smile:

This is awesome though. I’m a bit shocked you were able to whip this up so quickly.

Cool! Yeah it’s a bit slow. I compared it against the XBOX 360 controller and the speed is exactly the same when you push the sticks to maximum, so it’s a limitation of the Unreal Editor itself! To fix this I think it means changing the Editor viewport code in the UE4 project. I want to experiment with that, and post a patch to speed it up!

Also another problem - the deadzone is way too large IMHO - and it’s hardcoded in the Editor (ugh) at 0.2 out of 1.0 - 20%! A workaround may be to add an offset to the axes readings in the plugin to get around it, but that won’t solve the slowness.

Rotating around objects - was there a key combo to do that when using the mouse? I can’t remember if it was CTRL+SHIFT+LMB+moving mouse. Hmmmmmmmm. I do see code in the Editor related to orbiting.

I can see why Epic needs several weeks to do proper support - the Unreal Editor is very mouse-centric and that code would have to be rewritten to support the Space Navigator! :open_mouth:

Anyways, I’m glad you got it working - I hope it is still useful enough for real work?

Oh good catch on the speed adjustment - that got me thinking about how the values are reported - so I ran the SDK demo code and indeed, if I set the speed to maximum the range goes up to over 10,000. Whereas if you leave the speed in the middle (1.0) it’s around 2,000! The plugin clips at 2048, so if you go too large it can wrap around when reported to the Editor, I think.

Ah yes, that may be why it feels a bit sluggish.

Just select something and then ALT + MouseLeft drag does it for me. F to focus on the object.

Yeah sure, can combine it with mouse too. Not like I have to use either/or :slight_smile:

Hmmm - maybe you need to run the GenerateProjectFiles.bat file so that the build tool will see the 3DxWare files in your ThirdParty directory?

Oh - and just in case maybe you need to create a 3DxWare.Build.cs file in your Engine\Source\ThirdParty\3DxWare directory first, with the following inside it:



// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;

public class ThreeDxWare : ModuleRules
{
	public ThreeDxWare (TargetInfo Target)
	{
		Type = ModuleType.External;

        string ThreeDxWareSDKDir = UEBuildConfiguration.UEThirdPartySourceDirectory + "3DxWare";

		// Ensure correct include and link paths for xinput so the correct dll is loaded (xinput1_3.dll)
        PublicSystemIncludePaths.Add(ThreeDxWareSDKDir + "/Inc");
		if (Target.Platform == UnrealTargetPlatform.Win64)
		{
            PublicLibraryPaths.Add(ThreeDxWareSDKDir + "/Lib/x64");
		}
		else if (Target.Platform == UnrealTargetPlatform.Win32)
		{
            PublicLibraryPaths.Add(ThreeDxWareSDKDir + "/Lib/x86");
		}
        PublicAdditionalLibraries.Add("siapp.lib");
	}
}


And then run GenerateProjectFiles.bat. It will probably recompile the whole engine though.

After poking around the UnrealEd code some more, it looks like we can tweak the hardcoded values to reduce the deadzone and maybe increase the rotation and translation speed. In the CameraController.h file, you’ll see this:


/** Constructor */
	FCameraControllerConfig()
		: ImpulseDeadZoneAmount( 0.2f ),
		  bUsePhysicsBasedMovement( true ),	  
		  MovementAccelerationRate( 20000.0f ),
		  MovementVelocityDampingAmount( 10.0f ),
		  MaximumMovementSpeed( MAX_FLT ),
		  bUsePhysicsBasedRotation( false ),
		  bForceRotationalPhysics( false ),
		  RotationAccelerationRate( 1600.0f ),
		  RotationVelocityDampingAmount( 12.0f ),
		  MaximumRotationSpeed( MAX_FLT ),
		  MinimumAllowedPitchRotation( -90.0f ),
		  MaximumAllowedPitchRotation( 90.0f ),
		  bEnableFOVRecoil( true ),
		  bUsePhysicsBasedFOV( true ),
		  FOVAccelerationRate( 1200.0f ),
		  FOVVelocityDampingAmount( 10.0f ),
		  MaximumFOVSpeed( MAX_FLT ),
		  MinimumAllowedFOV( 5.0f ),
		  MaximumAllowedFOV( 170.0f ),
		  TranslationMultiplier(1.0f),
		  RotationMultiplier(1.0f),
		  ZoomMultiplier(1.0f),
		  PitchTrim(0.0f),
		  bInvertX(false),
		  bInvertY(false),
		  bPlanarCamera(false),
		  bLockedPitch(true)
	{
	}


The deadzone is the variable ImpulseDeadZoneAmount, and to increase the speed of translation and rotation we can increase the values assigned to TranslationMultiplier and RotationMultiplier. I’ll give them a try tonight to see if this works! Although even if it does work, I’m not sure it is possible for a plugin to tweak these heh.

Ah yeah fixed the source issue in the mean time, just had an additional 3dxWare folder inside the other from a previous integration (yes I had the libs integrated before but then never went anywhere with it). Also needed to download the latest SDK for virtualkeys.hpp.

Yup, it’s better with 0 for sure, or near at least. One issue I’m noticing now with rotation is that the max speed is reached way before I can’t turn the space navigator any further. I think if the full range would actually work linearly, the lacking speed problem would solve itself?

EDIT: Scratch that, multiplier of the plugin output won’t help with maximum translation/rotation speed - still need to modify CameraController.h for that.