Scripted player camera
Thread for pull #1215
I have created a Lua function which allows scripting the player's camera. You specify a position offset, rotation offset, FOV multiplier, and transition time. Additionally you can specify whether that's a third person viewpoint, in which case the wielded item is hidden and the player can see their own model.
One practical use is allowing players of different sizes to have a correct eye position... so a server can offer both giant and midget player models, while this makes it possible to define a proper camera height for each. Another is vehicles, which can now setup a behind view like any racing game when entered. Also beds, for which you can offset the location and rotation of the camera to make it look like you're laying down. It can also be used to change the FOV as an effect for specific actions... like being underwater or running. Many more uses can probably be found.
Note that this might invalidate existing "third person camera" patches, as it adds the ability to have a 3rd person camera but with a lot more features... no harm meant to the authors of those patches, since a choice between this and them might have to be taken. Also note that the local player model is still networked and will visually lag like any player on the server, which can probably be fixed later.
I have created a Lua function which allows scripting the player's camera. You specify a position offset, rotation offset, FOV multiplier, and transition time. Additionally you can specify whether that's a third person viewpoint, in which case the wielded item is hidden and the player can see their own model.
One practical use is allowing players of different sizes to have a correct eye position... so a server can offer both giant and midget player models, while this makes it possible to define a proper camera height for each. Another is vehicles, which can now setup a behind view like any racing game when entered. Also beds, for which you can offset the location and rotation of the camera to make it look like you're laying down. It can also be used to change the FOV as an effect for specific actions... like being underwater or running. Many more uses can probably be found.
Note that this might invalidate existing "third person camera" patches, as it adds the ability to have a 3rd person camera but with a lot more features... no harm meant to the authors of those patches, since a choice between this and them might have to be taken. Also note that the local player model is still networked and will visually lag like any player on the server, which can probably be fixed later.