Browse Source

Use s curve instead, 160 midpoint

1/(1+(x/1-x)^-b where b = 2.3
m3ales 4 years ago
parent
commit
a81fe726d9

+ 1 - 2
addons - Copy/RD501_Main/functions/jammer/fnc_addJammer.sqf

@@ -1,5 +1,4 @@
-params["_jammer", ["_radius", 300], ["_strength", 400]];
-
+params["_jammer", ["_radius", 300], ["_strength", 160]];
 
 _jammers = missionNamespace getVariable ["rd501_jammers",[]];
 

+ 2 - 21
addons - Copy/RD501_Main/functions/jammer/fnc_jammersPFH.sqf

@@ -25,27 +25,8 @@ private _interference = 1;
 	_x params["_jammer", "_radius", "_strength"];
 	private _distance = _player distance _jammer;
 	if (_distance < _radius) then {
-		//cubic bezier curve
-
-		// private _t = 0;
-		// private _m = 1 -_t;
-		// private _x0 = 0;
-		// private _x1 = 1.1;
-		// private _x2 = 0.9;
-		// private _x3 = 1;
-		// private _y0 = 0.1;
-		// private _y1 = 0.5;
-		// private _y2 = 0.8;
-		// private _y3 = 1;
-
-		// private _xr = (_y0*_m*_m*_m) + (3*_t*_y1*_m*_m) + (3*_t*_t*_y2*_m) + (_t*_t*_t*_y3);
-		// private _yr = (_x0*_m*_m*_m) + (3*_t*_x1*_m*_m) + (3*_t*_t*_x2*_m) + (_t*_t*_t*_x3);
-
-		// _yr simplifies approx to y=1.6t³ - 3.9t² + 3.3t
-		// or t(1.6t² - 3.9t + 3.3)
-
-		private _t = _distance/_radius;
-		private _specificSignal =  (_t * ((1.6*_t*_t) - (3.9 * _t) + 3.3));
+		private _d = _distance/_radius;
+		private _specificSignal =  1/(1 + ((_d/(1 -_d)) ^ -2.3));
 		private _specificInterference = _strength * (1 - _specificSignal);
 		if(_interference == 1) then {
 			_interference = _specificInterference;