@@ -165,6 +165,10 @@ float LookRightAngle1p = 80.0f;
165165float LookLeftAngle3p = 90 .0f ;
166166float LookRightAngle3p = 90 .0f ;
167167
168+ bool InertiaAffectsPitch3p = false ;
169+
170+ bool InertiaEffects1p = true ;
171+
168172float semiDelayedVehSpeed = 0 .f;
169173float delayedVehSpeed = 0 .f;
170174
@@ -190,6 +194,7 @@ float RelativeLookFactor = 0.f;
190194bool readInputFromMt = true ;
191195float vehDelayedAccel = 0 .f;
192196float vehDelayedAccel2 = 0 .f;
197+ float smoothIsGoingForwardInc = 0 .f;
193198
194199char * reloadKey = " F10" ;
195200char * toggleModKey = " 1" ;
@@ -325,6 +330,10 @@ float easeInSine(float t) {
325330 return -1 .f * cos (t / 1 .f * (PI * 0 .5f )) + 1 .f ;
326331}
327332
333+ float easeOutSine (float t) {
334+ return sin (t / 1 * (PI * 0.5 ));
335+ }
336+
328337// Range -1.f | 1.f
329338float easeInSineInput (float axisInput)
330339{
@@ -583,6 +592,10 @@ void ReadSettings(bool notify)
583592
584593 LookLeftAngle3p = (float ) ini.GetDoubleValue (" 3rdPersonView" , " lookLeftAngle" , 90.0 );
585594 LookRightAngle3p = (float )ini.GetDoubleValue (" 3rdPersonView" , " lookRightAngle" , 90.0 );
595+
596+ InertiaAffectsPitch3p = ini.GetLongValue (" 3rdPersonView" , " InertiaAffectsPitch" , 0 ) > 0 ;
597+
598+ InertiaEffects1p = ini.GetLongValue (" 1stPersonView" , " InertiaEffects" , 1 ) > 0 ;
586599
587600 LookLeftAngle1p = (float )ini.GetDoubleValue (" 1stPersonView" , " lookLeftAngle" , 75.0 );
588601 LookRightAngle1p = (float )ini.GetDoubleValue (" 1stPersonView" , " lookLeftAngle" , 80.0 );
@@ -946,21 +959,21 @@ void updateVehicleProperties()
946959 if (vehClass == eVehicleClass::VehicleClassCoupes || vehClass == eVehicleClass::VehicleClassSports || vehClass == eVehicleClass::VehicleClassSportsClassics || vehClass == eVehicleClass::VehicleClassMuscle)
947960 {
948961 // sports - coupes - muscles
949- playerHeadAltitude = 0 .65f ;
950- playerHeadDistance = -0 .53f ;
962+ playerHeadAltitude = 0 .675f ;
963+ playerHeadDistance = -0 .56f ;
951964 }
952965 else if (vehClass == eVehicleClass::VehicleClassSuper)
953966 {
954967 // super sport
955- playerHeadAltitude = 0 .615f ;
956- playerHeadDistance = -0 .58f ;
968+ playerHeadAltitude = 0 .645f ;
969+ playerHeadDistance = -0 .61f ;
957970
958971 }
959972 else
960973 {
961974 // anything else
962- playerHeadAltitude = 0 .67f ;
963- playerHeadDistance = -0 .53f ;
975+ playerHeadAltitude = 0 .695f ;
976+ playerHeadDistance = -0 .56f ;
964977 }
965978
966979 skelPos += vehUpVector * playerHeadAltitude;
@@ -1114,10 +1127,30 @@ void updateCameraDriverSeat() {
11141127 UI::SHOW_HUD_COMPONENT_THIS_FRAME (eHudComponent::HudComponentReticle);
11151128 }
11161129
1117- CAM::SET_CAM_COORD (customCam, camPos.x (), camPos.y (), camPos.z ());
1130+ float distIncFinal = 0 .f ;
1131+
1132+ if (InertiaEffects1p) {
1133+ float accelScale = VEHICLE::GET_VEHICLE_ACCELERATION (veh);
1134+
1135+ float vehDirectAccel = ((double )(vehAcceleration * accelScale)) * 1700.0 ;
1136+ vehDelayedAccel = lerp (vehDelayedAccel, vehDirectAccel, 1 .725f * getDeltaTime ());
1137+ vehDelayedAccel2 = lerp (vehDelayedAccel2, vehDirectAccel, 0 .765f * getDeltaTime ());
1138+
1139+ if (vehSpeed <= 0 .02f && vehDelayedAccel > vehDelayedAccel2)
1140+ vehDelayedAccel2 = lerp (vehDelayedAccel2, vehDelayedAccel, 8 .f * getDeltaTime ());
1141+
1142+ float accelThreshold = (vehDelayedAccel - vehDelayedAccel2);
1143+
1144+ distIncFinal = accelThreshold + max (0 .f , vehSpeed * 0 .01295f ) - 0 .3f ;
1145+
1146+ distIncFinal *= 0 .175f ;
1147+ distIncFinal = clamp (distIncFinal, -0 .1f , 0 .1f );
1148+ }
11181149
11191150 float btnLookingFactor = abs (RelativeLookFactor);
11201151
1152+ Quaternionf finalQ;
1153+
11211154 if (isBike) {
11221155 CAM::STOP_CAM_POINTING (customCam);
11231156 Vector3f rot = toV3f (ENTITY::GET_ENTITY_ROTATION (veh, 2 ));
@@ -1140,7 +1173,7 @@ void updateCameraDriverSeat() {
11401173 * AngleAxisf (pitch, Vector3f::UnitY ())
11411174 * AngleAxisf (yaw, Vector3f::UnitZ ());
11421175
1143- Quaternionf finalQ = smoothQuatSeat * qLookLeftRight;
1176+ finalQ = smoothQuatSeat * qLookLeftRight;
11441177
11451178 if (isAiming || hasInputThisFrame)
11461179 {
@@ -1189,7 +1222,7 @@ void updateCameraDriverSeat() {
11891222 * AngleAxisf (pitch, Vector3f::UnitY ())
11901223 * AngleAxisf (yaw, Vector3f::UnitZ ());
11911224
1192- Quaternionf finalQ = smoothQuatSeat * qLookLeftRight;
1225+ finalQ = smoothQuatSeat * qLookLeftRight;
11931226
11941227 if (isAiming || hasInputThisFrame)
11951228 {
@@ -1225,6 +1258,10 @@ void updateCameraDriverSeat() {
12251258 SET_CAM_QUATERNION (customCam, finalQ);
12261259 }
12271260
1261+ camPos = camPos + smoothQuatSeat * back * distIncFinal;
1262+
1263+ CAM::SET_CAM_COORD (customCam, camPos.x (), camPos.y (), camPos.z ());
1264+
12281265 CAM::RENDER_SCRIPT_CAMS (true , false , 3000 , 1 , 0 );
12291266}
12301267
@@ -1375,17 +1412,32 @@ void updateCam3pNfsAlgorithm()
13751412 // smoothAccelDist = lerp(smoothAccelDist, ((vehAcceleration * VEHICLE::GET_VEHICLE_ACCELERATION(veh)) * 1700.f), 0.75f * getDeltaTime());
13761413 // smoothAccelDist = clamp(smoothAccelDist, -0.8f, 1.7f);
13771414
1378- float vehDirectAccel = (vehAcceleration * VEHICLE::GET_VEHICLE_ACCELERATION (veh)) * 1700 .f ;
1379- vehDelayedAccel = lerp (vehDelayedAccel, vehDirectAccel, 1 .75f * getDeltaTime ());
1380- vehDelayedAccel2 = lerp (vehDelayedAccel2, vehDirectAccel, 0 .95f * getDeltaTime ());
1415+ float accelScale = VEHICLE::GET_VEHICLE_ACCELERATION (veh);
1416+
1417+ float vehDirectAccel = ((double )(vehAcceleration * accelScale)) * 1700.0 ;
1418+ vehDelayedAccel = lerp (vehDelayedAccel, vehDirectAccel, 1 .735f * getDeltaTime ());
1419+ vehDelayedAccel2 = lerp (vehDelayedAccel2, vehDirectAccel, 0 .625f * getDeltaTime ());
1420+
1421+ float isGoingForwardInc = clamp ( ((vehSpeed - 1 .f ) * 0 .6f ) * accelScale, 0 .f , 1 .2f ) * 0 .425f ;
1422+ smoothIsGoingForwardInc = lerp (smoothIsGoingForwardInc, isGoingForwardInc, 0 .8f * getDeltaTime ());
13811423
1382- float distIncFinal = (vehDelayedAccel - vehDelayedAccel2) + max ( 0 . f , vehSpeed * 0 . 0125f );
1424+ float accelThreshold = (vehDelayedAccel - vehDelayedAccel2);
13831425
1384- // if (distIncFinal < 0.f)
1385- // distIncFinal * max(0.f, 1.0f - (smoothStep(0.f, 1.f, unlerp(0.f, -0.8f, distIncFinal)) * 5.f));
1426+ float distIncFinal = clamp (accelThreshold, -1 .7f , 1 .5f ) + max (0 .f , vehSpeed * 0 .01295f ) - 0 .3f + smoothIsGoingForwardInc;
13861427
13871428 distIncFinal *= 0 .7f ;
13881429
1430+ float lookDownThreshold = 0 .f ;
1431+
1432+ if (InertiaAffectsPitch3p) {
1433+
1434+ lookDownThreshold = clamp (accelThreshold + 0 .2f , -1 .f , -0 .0f );
1435+
1436+ // float aux = -lookDownThreshold;
1437+ // lookDownThreshold = -smoothStep(0.f, 1.f, aux);
1438+ }
1439+
1440+
13891441 float airDistance = lerp (0 .f , 2 .5f , smoothIsInAirNfs * (lerp (0 .6f , 1 .2f , smoothIsInAirNfs)));
13901442
13911443 Vector3f posCenter = vehPos + (up * heightOffset3P) + (vehForwardVector * finalPivotFrontOffset);
@@ -1515,7 +1567,7 @@ void updateCam3pNfsAlgorithm()
15151567
15161568 rotEuler[1 ] = 0 .f ;
15171569
1518- CAM::SET_CAM_ROT (customCam, rotEuler.x () /* - heightInc */ , rotEuler.y (), rotEuler.z (), 2 );
1570+ CAM::SET_CAM_ROT (customCam, rotEuler.x () + (lookDownThreshold * 7 . 5f ) , rotEuler.y (), rotEuler.z (), 2 );
15191571}
15201572
15211573void updateCameraSmooth3P () {
0 commit comments