Camera Refactor #2652
garrynewman
announced in
Announcements
Camera Refactor
#2652
Replies: 3 comments 2 replies
-
FYI I've got two big bugs to fix in the morning I am aware of them, let me know if you hit anything else.. |
Beta Was this translation helpful? Give feedback.
2 replies
-
This is a good refactor, especially getting it out of the way now before release. 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Changes here to simplify and clean up the camera system. I appreciate this is going to annoy and upset a few people because I removed a system they were using, but I do feel this is the right move in order to minimize the amount of code needed to create something.
Transitions
CameraMode
is deleted[Event.Frame]
becomes[Event.Client.Frame]
(to emphasise that it only gets called clientside)PlayerId
becomesSteamId
(to remove ambiguity between client id, network id, steam id)Game
becomesGameManager
(Game was too generic)StandardPlayerAnimator
is deleted (Check outCitizenAnimationHelper
if you want to do similar things)CurrentView
is deleted (Rename it all to Camera.)Camera Suggestions
The global Camera is now accessible and changeable anywhere during the game loop clientside. So where you change it is up to you. I'd suggest changing it somewhere that is called every frame, such as in an Event,Client.Frame, or in FrameSimulate, or in Event.Client.PostCam.
If you were using the components camera system previously, I have made the camera system worse for you. If you want to make the camera object orientated again you should be able to easily do that yourself by looking at the code above and creating a system to do it. The point of this change was to get the camera system down to a place where it can't be any simpler. Complication is opt-in.
EyePosition
EyeRotation and EyePosition on base entity hasn't felt right to me, but removing it completely would cause a ton of headaches for a ton of people. So instead I've replaced it with a
virtual Ray AimRay { get; set; }
which you can override in your entity classes to provide eye position and rotation.Field Of View
Internally the engine translated field of view to be vertical fov with the aspect ratio. This seems like it was something that was left over from Source 1 and Valve wanted to keep that parallel. I got rid of it. It caused a bunch of confusing behaviour when picking the screen.
So now the FOV you set on Camera.FieldOfView is the FOV that gets rendered. You can switch the field of view back to vertical using this helper function.
Beta Was this translation helpful? Give feedback.
All reactions