Support for Space Navigator 3D Mouse?

Anyone else try the plugin yet? (Should work for Unreal Engine 4.10.1, not sure about 4.10.0)

Gigantoad, I changed my ShortToNormalizedFloat function to workaround the editor’s 0.2 deadzone. Yeah, it’s hacky, and the function should be renamed.



static float ShortToNormalizedFloat(long AxisVal)
{
	// normalize -32768..32767] -> -1..1]
	const float Norm = (AxisVal <= 0 ? 2100.f : 2100.f);
	float prenorm = float(AxisVal) / Norm;

	if (prenorm == 0.0)
		return 0.0;

	prenorm *= 0.8;

	if (GIsEditor)
	{
		// scale (0,1] into [0.2,1] range to get around hardcoded deadzone in editor
		return prenorm + (AxisVal <= 0 ? -0.2f : 0.2f);
	}
	return 3.0*prenorm + (AxisVal <= 0 ? -0.2f : 0.2f);
}


On my system it eliminates the deadzone. Combined that with changing CameraController.h to use a 3.0x rotation and translation multiplier and it’s fast but still have good control.

As an aside, I’m playing around with the editor viewport code, and getting the space navigator to work in orbit mode is difficult. I can see why the Unreal devs would need to spend several weeks on it - it would probably mean rewriting the orbiting code!

And now I can get it to work in orbit mode - orbit rotate and orbit zoom (not pan). Unfortunately, this again means changing the editor source - this cannot be done in a plugin.

Yup that seems to work fine! Pretty usable overall. This seems to do nothing though.


const float Norm = (AxisVal <= 0 ? 2100.f : 2100.f);

Also just in case you’re not aware of this method in FMath:


	const float Normalized = FMath::GetMappedRangeValueClamped(FVector2D(-24000.f, 24000.f), FVector2D(-1.f, 1.f), AxisVal);


Yeah that Norm calculation is a legacy of the old Steam controller plugin code. It used to be -32768.f : 32767.f because that was the original range.

For gaming I added the 3.0x multiplier - just so that I don’t wreck my space navigator when I’m strafing. Season to taste. :stuck_out_tongue:

I figured out how to do panning in orbit mode - but I’m not sure if I like it. I do like my change where you can zoom and rotate at the same time, instead of requiring alt+rmb to orbit zoom, and alt+lmb to orbit rotate. I changed it so that only ALT needs to be held down to orbit with the space navigator. I probably broke something doing that though - if there are other views that depend on it.

Yeah don’t worry about orbit I think, it’s pretty smooth now without the dead zone. Also orbit is probably more important during modelling when you actually work on a mesh but none of that happens in inside UE4 anyway. Rotation is still a tad slow even when maxed out in the driver (as far as it goes without the reversal problem anyway), but i’s not too far from ideal. Excellent stuff overall, thanks again :slight_smile:

Not sure why nobody else is trying it though.

No problem. :slight_smile:

Oh, you tried editing CameraController.h and changing the TranslationMultiplier and RotationMultiplier variables, then recompiling the editor? That speeds up the rotation a lot, yet keeps the precision. I use a value of 3.0, and it feels good to me!

Yep messing with RotationMultiplier works great. Of course this affects gamepad too but who cares. Good stuff, maybe you should make a new thread in the work in progress or somewhere more prominent? Feedback for Epic doesn’t seem very fitting anymore.

Yeah I was thinking about doing that - good idea! Thanks for beta-testing and the feedback. :slight_smile:

Oh, possibly another bug when you move around an object while moving the 3d mouse it can throw off the move axis somehow. Like drag red x axis arrow, object moves just along x axis, use 3d mouse while still moving the object it can start to move in strange ways :slight_smile:

Heh yeah - when I was working on the Orbit Pan movement, I put in code to ignore any mouse movements if there is any space navigator movement at the same time. You don’t want them fighting each other! Similar logic will probably be needed for the rest of the movements.

Unfortunately, this is in the Editor, not the plugin. :frowning:

Ah I see. Well it’s no biggie.

How did you get the plugin compiled for the binary version of the engine by the way? I’m just trying to copy over the compiled thing from the 4.10.1 source version but it keeps complaining that UE4Editor-.dll module is missing or built with different engine version.

Oh - uh I think you need to find the file moduleversion.h and change the line that says


#define MODULE_API_VERSION 0

to:


#define MODULE_API_VERSION 2758231

Then recompile.

I’m assuming from the 4.10.1 source code. I think Epic did it this way so you can’t accidentally use plugins in a different unreal engine version by accident.

Ah yes, that got me on the right track. In there is this construct:


#if BUILT_FROM_CHANGELIST > 0
	#if ENGINE_IS_LICENSEE_VERSION
		#define MODULE_API_VERSION BUILT_FROM_CHANGELIST
	#else
		#define MODULE_API_VERSION 2758231 /* Or hotfix compatibility changelist */
	#endif
#else
	#define MODULE_API_VERSION 0
#endif

So the problem is actually in \Engine\Source\Runtime\Launch\Resources\Version.h


#define BUILT_FROM_CHANGELIST 0

This needs to be set to > 0, otherwise the MODULE_API_VERSION ends up 0 too resulting in the version mismatch. I’ve set it to the current changelist 2791327 from the release branch. Not that it matters but just to keep it clean.

It’s described in a bit more detail here: Compiling game modules with github source to be used by non github source developers - C++ - Epic Developer Community Forums

Yup that works too! :slight_smile:

Thanks for the link - I had to google around to find the other approach.

I have just recompiled your Space Navigator plugin for UE4.11 Preview1 for Win64 (VS2015):

sharing

To use copy it into Binaries/Win64 directory of the plugin.

Nice! How is it working for you?

It’s works just perfectly :slight_smile:

Cool! :slight_smile: It’s limited - you can’t do orbits without changing Unreal Editor source, but hopefully useful enough to be productive!