microdee / UE4-SpaceMouse

Control Viewport cameras with 3DConnexion SpaceMice, using HID directly.
MIT License
157 stars 23 forks source link

SpaceMouse for Unreal Engine

Not for Twinmotion. DO NOT expect it to work with Twinmotion.

Installation

Pre-Compiled for UE 4.23 .. 4.26.

Demo video: https://youtu.be/owcSTzs8p-8

Download manually for free

Buy it via the Marketplace

If you have a code project just use this repo as submodule

git submodule add https://github.com/microdee/UE4-SpaceMouse.git Plugins/SpaceMouse

Disclaimer about the new official plugin shipped by 3DConnexion

Requirements

This plugin works with the HID device directly and doesn't use 3DxWare (official "drivers") SDK or its services (similar how Blender does it). However it has different requirements depending on your operating system:

Config / Usage

You can control any 3D editor viewport (Perspective or Ortho) currently in focus (user needs to click on it first).

Alt text

Transition speed is controllable via the camera speed setting and the camera speed scalar of the viewport. Camera speed can be increased or decreased with configurable buttons on the spacemice. Multiple devices are supported however their data is merged together into a global context.

On default speeds (speed setting = 4) transition velocity is 1000 units/sec by default and rotation speed is 270°/sec by default. Rotation speed is not affected by camera speed settings. You can change these in the Editor Preferences -> Plugins -> SpaceMouse section.

Alt text

Buttons

With Button mappings one can remap some functionalities to SpaceMouse buttons.

Default editor bindings

There's a pre-defined default set of bindings you can activate by clicking on "Configure default button bindings".

Behavior

Active in Background When false, only control the camera of UE4 while the editor is the foreground application.

Camera Behavior Sets the mode of controlling the viewport camera. All behavior controls the viewport camera.

Orbiting

Orbiting Moves/Rotates Object When true, SpaceMouse represents the Delta movement of "the object" in front of the camera (meaning axes are inverted)

Orbiting at Fixed Pivot Distance When enabled, sets a fixed distance for the orbiting mode in UE4 units (usually cm).

Orbiting Line Trace Length is the maximum possible radius of the orbiting behavior in UE4 units (usually cm).

Orthographic viewports

Camera controls are slightly different when controlling an Orthographic viewport (Top/Bottom, Left/Right, Front/Rear). Rotation is disabled, and the SpaceMouse is used only to pan on the selected plane and zoom.

Ortho Zoom Speed An arbitrary multiplier of the Zoom speed while insdide an Orthographic viewport. Negative numbers reverse the direction of zooming.

OrthoPanningPlane Select the plane of the device (2 axes) which will control the panning motion inside an Orthographic viewport.

Axis configuration

Axis mappings are conversions between the space of spacemice and the space of UE4. You can invert rotations and translations here by flipping the sign. The default values are my subjective preferences (as you can see in the coordinate system image above).

Rotation/Translation Curve are defining the 0..1 curvature from resting state to fully pushed/pulled state of the SpaceMouse puck. Dead-zone, clamping, exponent or other less useful transformations can be expressed with this. Default is 0..1 linear curve, which means no effect.

Misc

Display Debug Information prints HID data onto the viewport. You don't need to change Max Hid Read Operations Per Frame. Just ignore it.

Report bugs

Have any feedback or ideas? Go to Discussions!

UE4 forum (please prefer Github Discussions)

More info

Changelog

Major changes from version 1.2

The structure of SpaceMouse preferences has changed significantly. Upon updating from prior versions (<= 1.1.x) you might need to re-configure the plugin. Don't worry though, the button binding UX has been improved significantly.

Major changes from version 1.1

Upon updating from prior versions (<= 1.0.x pre-marketplace) please delete both HIDUE and SpaceMouse plugins from your Engine or Project plugins folder!

  1. Editor settings is moved to Plugins -> SpaceMouse to follow conventions
  2. HIDUE is now demoted to a module instead of an entire plugin
  3. This repository now only contains the plugin itself which you can also directly submodule now in your code projects if you wish.

Build a release

If for any reason you cannot use this plugin as a submodule and you want to make a pre-built release to be an engine plugin, then work with the official test project and see the build instructions there.

Build a release for Linux

To make a pre-built release for Linux, read the Linux Build Guide.

Note on macOS support

3DConnexion claims to have Mac support for their official plugin now. In light of that Mac support is no longer persued and if you want to use your Space Mouse on Mac with Unreal Engine you should install their official plugin. This plugin keeps support for Windows and Linux (reportedly).

Known issues:

Known nuances

Credits