X Tutup
Skip to content

Improve the follow modes for too far ranges#6190

Merged
sturnclaw merged 2 commits intopioneerspacesim:masterfrom
Gliese852:fix-far-rotations
Sep 9, 2025
Merged

Improve the follow modes for too far ranges#6190
sturnclaw merged 2 commits intopioneerspacesim:masterfrom
Gliese852:fix-far-rotations

Conversation

@Gliese852
Copy link
Contributor

Probably a slightly more thorough solution to the problem of #6081.
If earlier this problem was solved through the opportunity to manually turn off the follow mode, even when it is too far for it, now it is turned off automatically. Also, a different maximum range is assigned for different modes. For follow position mode, this is 1000 km, since it can be convenient for intercepting the ship. For the follow orientation mode, it is 10 km, since it makes little sense over long distances, and the ship most likely cannot correctly follow the rotating target.

Also along the way fixed some warnings in PlayerShipController.

Comment on lines +690 to +701
if (InputBindings.primaryFire->IsActive() || (Pi::input->MouseButtonState(SDL_BUTTON_LEFT) && Pi::input->MouseButtonState(SDL_BUTTON_RIGHT))) {
//XXX worldview? madness, ask from ship instead
m_ship->SetGunState(Pi::game->GetWorldView()->GetActiveWeapon(), 1);
if (gunManager &&
(InputBindings.primaryFire->IsActive() || (Pi::input->MouseButtonState(SDL_BUTTON_LEFT) && Pi::input->MouseButtonState(SDL_BUTTON_RIGHT)))) {
gunManager->SetAllGroupsFiring(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this change will cause weapons in group 0 (by default, forward-facing weapons) to fire when the player is looking backwards and trying to fire weapons in group 1 (by default, rear-facing weapons).

I'm not sure we currently have ships with rear-facing weapons at this time, but I'd appreciate a comment here indicating that support for per-view weapon groups needs to be restored in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sturnclaw Maybe then to do it right away?

gunManager->SetGroupFiring(Pi::game->GetWorldView()->GetActiveWeapon(), true);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works, thank you. In the future I'd like to assign mounts to individual views or "seats" (e.g. crew-manned turrets) but for now we can use the WorldView.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force-pushed this change.

@Bodasey
Copy link

Bodasey commented Jul 11, 2025

At least in my case, it has worked well.

 - distinguish limit range for follow position and follow orientation
   modes

 - automatically turn off the follow mode if the distance to the target
   has become too large for this mode

 - accordingly modify the flight assist button code

See also: pioneerspacesim#6081
@Gliese852 Gliese852 force-pushed the fix-far-rotations branch from f4a65c2 to a6f0109 Compare July 14, 2025 19:53
@sturnclaw sturnclaw merged commit 945a758 into pioneerspacesim:master Sep 9, 2025
4 checks passed
@sturnclaw
Copy link
Member

Merged, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup