diff --git a/CustomCameraVPlus.ini b/CustomCameraVPlus.ini index f3959f8..eab77a6 100644 --- a/CustomCameraVPlus.ini +++ b/CustomCameraVPlus.ini @@ -2,6 +2,12 @@ fov = 77.5 distanceOffset = 0.0 +# Determines the angle between the car and the camera, in deggress (this value can be increased if you want to see 'more road') +# Higher values will place the camera higher and looking down (to the vehicle) +# +# Any values below 0.0 or above 20.0 will be clamped to the nearest valid number +cameraAngle = 3.5 + lookLeftAngle = 90.0 lookRightAngle = 90.0 diff --git a/changelog.txt b/changelog.txt index 8edb009..15c16b2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +1.4 + +* Added an option to set the angle of the thrid person camera! (Configurable in settings) + 1.3 * Reworked dynamic camera distance based on acceleration and speed (third person camera). Fixes some bugs and provides better visual feedback. diff --git a/script.cpp b/script.cpp index ebfc8c5..35e233e 100644 --- a/script.cpp +++ b/script.cpp @@ -61,6 +61,7 @@ float fov1P = 75.F; float fov1PAiming = 60.f; float fov3PAiming = 60.f; float distanceOffset = 0.f; +float cameraAngle3p = 3.5f; const float PI = 3.1415926535897932f; int lastVehHash = -1; bool isBike = false; @@ -70,6 +71,8 @@ bool isInVehicle = false; float longitudeOffset3P = 0.f; float heightOffset3P = 0.f; +float heightIcrementCalc = 0.f; + float rotationSpeed3P = 4.75f; //bool useVariableRotSpeed3P = true; @@ -585,7 +588,8 @@ void ReadSettings(bool notify) lookLeftKey = strdup(ini.GetValue("keyMappings", "lookLeftKey", "B")); lookRightKey = strdup(ini.GetValue("keyMappings", "lookRightKey", "N")); - distanceOffset = (float) ini.GetDoubleValue("3rdPersonView", "distanceOffset", 0.); + distanceOffset = (float) ini.GetDoubleValue("3rdPersonView", "distanceOffset", 0.0); + cameraAngle3p = clamp((float)ini.GetDoubleValue("3rdPersonView", "cameraAngle", 3.5), 0.f, 20.f); fov3P = (float) ini.GetDoubleValue("3rdPersonView", "fov", 77.5); fov1P = (float) ini.GetDoubleValue("1stPersonView", "fov", 75.0); @@ -1015,7 +1019,7 @@ void updateVehicleProperties() longitudeOffset3P += 1.45f + distanceOffset; - //ShowNotification(std::to_string(longitudeOffset3P).c_str()); + heightIcrementCalc = longitudeOffset3P * tan(cameraAngle3p * PI / 180.0); vehHasTowBone = vehHasBone("tow_arm"); vehHasTrailerBone = vehHasBone("attach_female"); @@ -1402,7 +1406,7 @@ Vector3f V3Reflect(Vector3f vector, Vector3f normal) void updateCam3pNfsAlgorithm() { - float heigthOffset = 0.15f; + float heigthOffset = 0.15f + heightIcrementCalc; currentTowHeightIncrement = lerp(currentTowHeightIncrement, towHeightIncrement, 1.45f * getDeltaTime()); currentTowLongitudeIncrement = lerp(currentTowLongitudeIncrement, towLongitudeIncrement, 1.75f * getDeltaTime()); @@ -1567,7 +1571,7 @@ void updateCam3pNfsAlgorithm() rotEuler[1] = 0.f; - CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f), rotEuler.y(), rotEuler.z(), 2); + CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f) - cameraAngle3p, rotEuler.y(), rotEuler.z(), 2); } void updateCameraSmooth3P() {