Skip to content

Fix camera view modes not working while spectating - #5291

Open
TheCrazy17 wants to merge 3 commits into
multitheftauto:masterfrom
TheCrazy17:feat/camera-target-view-modes
Open

Fix camera view modes not working while spectating#5291
TheCrazy17 wants to merge 3 commits into
multitheftauto:masterfrom
TheCrazy17:feat/camera-target-view-modes

Conversation

@TheCrazy17

Copy link
Copy Markdown
Contributor

Summary

GTA handles the change camera key inside CCamera::CamControl, but it stays dead while a script owns the camera, which is how setCameraTarget takes it: the cycle and click sound gates require a player owned camera, and the zoom easing follows leftover script zoom values that discard the index. While the camera follows a focused entity the client now opens those gates and clears the script zoom flags, so the native cycling runs untouched, and restores everything when the camera is released.

Refocusing between a ped and a vehicle is committed right after TakeControl, mirroring the jumpcut block CamControl uses, so the camera switches properly when the spectated player enters or leaves a vehicle.

The bumper and cinematic modes stay out: the cinematic system retargets using the local player, and the bumper view relies on the vehicle shell falling outside the near plane, which does not hold on remote vehicles. Spectating cycles through the three zoom levels. (Maybe we can fix or implement them later)

https://streamable.com/1l4hy5

Motivation

Fixes #669.

Test plan

  1. setCameraTarget another player and press the change camera key; the three zooms cycle with the native click sound, both on foot and in a vehicle.
  2. Spectate someone who enters and leaves a vehicle; the camera follows the change.
  3. Regular gameplay, setCameraMatrix fixed cameras and restoring the camera afterwards behave as before.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

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.

You can't change camera mode while spectating player

1 participant