UE4-SpaceMouse icon indicating copy to clipboard operation
UE4-SpaceMouse copied to clipboard

Camera Viewport speed relative to distance from object

Open aknittel1 opened this issue 2 years ago • 1 comments

I'm experimenting with landscapes and open worlds. Is there a way to set either unreal or the spacemouse parameters so the speed is relative to the distance from the object selected (slow for close, fast for distant)? It just seems very slow when high above a landscape and too finicky when I am zoomed in on an object WITHIN the landscape. I have to constantly adjust the speed as I fly through the landscape, to the point where I am close to that Metahuman, the slightest touch of the Spacemouse to Pan jerks the actor out of view.

BTW I use this same mouse in Blender with their built-in driver and there is none of this constant camera speed adjusting equivalent needed no matter what I'm looking at or where I am in 3d space. It just does the right thing.

For instance, this setting in UE sounds like it has SOMETHING to do with what I'm desiring:

bUseDistanceScaledCameraSpeed=True

But i turned this off and on with NO EFFECT on the space mouse.

I'm using these project settings by the way which have served me well on other non-open world projects:

[/Script/SpaceMouse.SpaceMouseConfig] CameraBehavior=OrbitingNoRoll MovementSecondsTolerance=1.0 RotationDegreesPerSec=20.000000 PitchAxisMap=(X=0.000000,Y=1.000000,Z=0.000000) RollAxisMap=(X=0.000000,Y=0.000000,Z=0.000000) TranslationUnitsPerSec=500.000000 XTranslationAxisMap=(X=0.000000,Y=1.000000,Z=0.000000) YTranslationAxisMap=(X=-1.000000,Y=0.000000,Z=0.000000) ZTranslationAxisMap=(X=0.000000,Y=0.000000,Z=1.000000) SpaceMouse_UE_Issue YawAxisMap=(X=0.000000,Y=0.000000,Z=-1.000000) MaxHidReadOperationsPerFrame=2048 DisplayDebugInformation=False ActiveInBackground=False IncreaseSpeedButton=SpaceMouseUE_KeyF2

I have your code and can build it now, but you would have to guide me in what to modify or change.

aknittel1 avatar Oct 21 '22 16:10 aknittel1

I have your code and can build it now, but you would have to guide me in what to modify or change.

Oh nice! So the naive solution is pretty simple: here I trace a line on the center of the screen and calculate the orbiting distance: https://github.com/microdee/UE4-SpaceMouse/blob/1c5e348579be0dae6f355f4519a1cf5112f64329/Source/SpaceMouse/Private/SmEditorManager.cpp#L178

You can use this distance to manipulate the speed of the camera. I'd suggest to create a configuration for enabling this, and maybe allow the user to specify a curvature which would modulate the relation between distance and speed. Once you're satisfied, it would be amazing if you'd make a PR for it ;)

As a sidenote, 3DConnexion's official plugin and therefore their official navigation scheme does something similar (lowering the speed automatically when object surfaces are nearby). I'm not too big fan of that because I like manual control, but it's my own acquired taste.

microdee avatar Oct 22 '22 12:10 microdee