Skip to content

Commit edf23e7

Browse files
committed
Merge branch 'velocity-new'
2 parents 76ab76c + 7e9e569 commit edf23e7

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

CustomCameraVPlus.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
fov = 77.5
33
distanceOffset = 0.0
44

5+
# Determines the angle between the car and the camera, in deggress (this value can be increased if you want to see 'more road')
6+
# Higher values will place the camera higher and looking down (to the vehicle)
7+
#
8+
# Any values below 0.0 or above 20.0 will be clamped to the nearest valid number
9+
cameraAngle = 3.5
10+
511
lookLeftAngle = 90.0
612
lookRightAngle = 90.0
713

changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.4
2+
3+
* Added an option to set the angle of the thrid person camera! (Configurable in settings)
4+
15
1.3
26

37
* Reworked dynamic camera distance based on acceleration and speed (third person camera). Fixes some bugs and provides better visual feedback.

script.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ float fov1P = 75.F;
6161
float fov1PAiming = 60.f;
6262
float fov3PAiming = 60.f;
6363
float distanceOffset = 0.f;
64+
float cameraAngle3p = 3.5f;
6465
const float PI = 3.1415926535897932f;
6566
int lastVehHash = -1;
6667
bool isBike = false;
@@ -70,6 +71,8 @@ bool isInVehicle = false;
7071
float longitudeOffset3P = 0.f;
7172
float heightOffset3P = 0.f;
7273

74+
float heightIcrementCalc = 0.f;
75+
7376
float rotationSpeed3P = 4.75f;
7477

7578
//bool useVariableRotSpeed3P = true;
@@ -585,7 +588,8 @@ void ReadSettings(bool notify)
585588
lookLeftKey = strdup(ini.GetValue("keyMappings", "lookLeftKey", "B"));
586589
lookRightKey = strdup(ini.GetValue("keyMappings", "lookRightKey", "N"));
587590

588-
distanceOffset = (float) ini.GetDoubleValue("3rdPersonView", "distanceOffset", 0.);
591+
distanceOffset = (float) ini.GetDoubleValue("3rdPersonView", "distanceOffset", 0.0);
592+
cameraAngle3p = clamp((float)ini.GetDoubleValue("3rdPersonView", "cameraAngle", 3.5), 0.f, 20.f);
589593

590594
fov3P = (float) ini.GetDoubleValue("3rdPersonView", "fov", 77.5);
591595
fov1P = (float) ini.GetDoubleValue("1stPersonView", "fov", 75.0);
@@ -1015,7 +1019,7 @@ void updateVehicleProperties()
10151019

10161020
longitudeOffset3P += 1.45f + distanceOffset;
10171021

1018-
//ShowNotification(std::to_string(longitudeOffset3P).c_str());
1022+
heightIcrementCalc = longitudeOffset3P * tan(cameraAngle3p * PI / 180.0);
10191023

10201024
vehHasTowBone = vehHasBone("tow_arm");
10211025
vehHasTrailerBone = vehHasBone("attach_female");
@@ -1402,7 +1406,7 @@ Vector3f V3Reflect(Vector3f vector, Vector3f normal)
14021406

14031407
void updateCam3pNfsAlgorithm()
14041408
{
1405-
float heigthOffset = 0.15f;
1409+
float heigthOffset = 0.15f + heightIcrementCalc;
14061410

14071411
currentTowHeightIncrement = lerp(currentTowHeightIncrement, towHeightIncrement, 1.45f * getDeltaTime());
14081412
currentTowLongitudeIncrement = lerp(currentTowLongitudeIncrement, towLongitudeIncrement, 1.75f * getDeltaTime());
@@ -1567,7 +1571,7 @@ void updateCam3pNfsAlgorithm()
15671571

15681572
rotEuler[1] = 0.f;
15691573

1570-
CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f), rotEuler.y(), rotEuler.z(), 2);
1574+
CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f) - cameraAngle3p, rotEuler.y(), rotEuler.z(), 2);
15711575
}
15721576

15731577
void updateCameraSmooth3P() {

0 commit comments

Comments
 (0)