Skip to content

Commit

Permalink
Merge branch 'velocity-new'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rbn3D committed Aug 3, 2018
2 parents 76ab76c + 7e9e569 commit edf23e7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CustomCameraVPlus.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 8 additions & 4 deletions script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit edf23e7

Please sign in to comment.