Can mouselook be smoother?

Post Reply
Keeper
Posts: 97
Joined: Thu Jan 04, 2018 9:23 pm
Location: Indian Hills, Nevada, USA
Contact:

Can mouselook be smoother?

Post by Keeper »

Is there a way to get the mouse-controlled camera movements to be smoother? If one uses a key to rotate the camera, the result is very smooth. However, using the mouse to do the same rotation has a super choppy result.

In ShipController.cpp, I see a comment about possibly making something configurable, in this bit:

Code: Select all

		MoveableCameraController *mcc = static_cast<MoveableCameraController *>(Pi::game->GetWorldView()->GetCameraController());
		const double accel = 0.01; // XXX configurable?
		mcc->RotateLeft(mouseMotion[0] * accel);
		mcc->RotateUp(mouseMotion[1] * accel);
If I were to change that double accel value and recompile the game, what would be the effect? Is it a more fundamental case of how often the mouse is polled, or something else? It's definitely not a hardware setting on my system, as I've changed the mouse DPI, pointer speed, etc., but nothing changed the amount of "jump" between one camera position and the next when using the mouse.

The reason I ask is that I have set up a head-tracking device and got it to work in Pioneer! I have one program that causes a button press on my controller to act as a "hold middle mouse button" toggle, then the head-tracking software converting my head movements to mouse movements (and also mapping the same toggle button as a "reset camera" position so the movements always start with my head "centered"). Pretty cool... but really choppy. If there's a way to get the graphics engine to move smoothly from one position the mouse requests to the next, that would be awesome.
Keeper
Posts: 97
Joined: Thu Jan 04, 2018 9:23 pm
Location: Indian Hills, Nevada, USA
Contact:

Re: Can mouselook be smoother?

Post by Keeper »

I figured it out. It's in CameraController.cpp:

Code: Select all

void InternalCameraController::RotateUp(float frameTime)
{
	m_rotX -= 45.0f * frameTime;
}

void InternalCameraController::RotateDown(float frameTime)
{
	m_rotX += 45.0f * frameTime;
}

void InternalCameraController::RotateLeft(float frameTime)
{
	m_rotY -= 45.0f * frameTime;
}

void InternalCameraController::RotateRight(float frameTime)
{
	m_rotY += 45.0f * frameTime;
}
That's for the internal camera. Similar values exist farther down for the external mouse-look camera. Changing the 45 to 1 for each direction makes for much smoother mouse movement but you have to lift the mouse a few times to get all the way around. For head tracking that's OK as originally the default tracker setting had about three full rotations when I looked to the right or left. The value of 1 is still a little choppy if I move my head quickly (I'm spoiled by my 144Hz screen refresh rate). I've even set 0.1 and it barely moves with the mouse. I tried 0.5 also but I think 1 was better. I'll have to experiment with the head tracker and find a sweet spot.

However, the default value of 45, for both internal and external views, seems a bit excessive. (Use the mouse to look around with an external view and notice you probably go round and round your ship a couple times before you need to lift your mouse.) So you might want to lower these values on your build even for mouse use. Certainly it will improve the smoothness when you're zoomed into your ship, which is when otherwise it gets pretty obviously choppy. (Obviously a value of 1 could be accomplished by removing the number completely and setting each value to frameTime straight up.)

I guess the ideal solution is a slider option that users can set for mouse camera movement rate. I'm no programmer though so I must leave that to the experts.

While I'm at it, I'm reducing the sensitivity of the mouse scroll wheel zoom. A little more scrolling for finer camera control is a trade-off worth having.
impaktor
Posts: 1009
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Can mouselook be smoother?

Post by impaktor »

Sounds like low hanging fruit if anyone is up for it.

To either put it in a variable in config file, or expose to lua, and set in settings-window.

Should just be a copy-paste of how other variables have been exposed to settings / config file
Keeper
Posts: 97
Joined: Thu Jan 04, 2018 9:23 pm
Location: Indian Hills, Nevada, USA
Contact:

Re: Can mouselook be smoother?

Post by Keeper »

While at it, a slider or text-entry box so end-users can adjust the FOV to their liking would be awesome. There'd have to be a note about needing to reboot one's system for it to take effect properly, though. As I recall from when I first adjusted the FOV, the HUD icons did not match up after changing the FOV and restarting the game. When I went to play again the next day, they matched up. Apparently the FOV information is kept in memory even after one leaves the game, so a reboot is necessary to get the GUI to adjust to it.
bszlrd
Posts: 1084
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: Can mouselook be smoother?

Post by bszlrd »

That's odd. Just tried changing the FOV, and the icons match up properly on my end. At least for thing close to me.
Post Reply