add the ability to see a light trail

This commit is contained in:
Brandon Danyluk 2021-05-08 02:49:16 -06:00
parent 5315b11177
commit 175652456b
4 changed files with 38 additions and 4 deletions

View File

@ -62,6 +62,8 @@ class CfgAmmo {
canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode
showTrail = 1;
// Guidance type for munitions // Guidance type for munitions
defaultSeekerType = "SACLOS"; defaultSeekerType = "SACLOS";
seekerTypes[] = { "SACLOS" }; seekerTypes[] = { "SACLOS" };

View File

@ -15,6 +15,8 @@ class CfgAmmo {
canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode
showTrail = 1;
// Guidance type for munitions // Guidance type for munitions
defaultSeekerType = "SACLOS"; defaultSeekerType = "SACLOS";
seekerTypes[] = { "SACLOS" }; seekerTypes[] = { "SACLOS" };

View File

@ -15,6 +15,7 @@
* *
* Public: No * Public: No
*/ */
#define TRAIL_COLOUR(multiplier) [1 * multiplier, 1 * multiplier, 0.3 * multiplier, 0.7 * multiplier]
BEGIN_COUNTER(guidancePFH); BEGIN_COUNTER(guidancePFH);
@ -24,15 +25,40 @@ _firedEH params ["_shooter","","","","_ammo","","_projectile"];
_launchParams params ["","_targetLaunchParams","","","","","_navigationType"]; _launchParams params ["","_targetLaunchParams","","","","","_navigationType"];
_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState", "_navigationParameters", "_guidanceParameters"]; _stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState", "_navigationParameters", "_guidanceParameters"];
_navigationStateParams params ["_currentState", "_navigationStateData"]; _navigationStateParams params ["_currentState", "_navigationStateData"];
_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance", "_stabilityCoefficient", "_showTrail"];
if (!alive _projectile || isNull _projectile || isNull _shooter) exitWith { if (!alive _projectile || isNull _projectile || isNull _shooter) exitWith {
[_pfID] call CBA_fnc_removePerFrameHandler; [_pfID] call CBA_fnc_removePerFrameHandler;
END_COUNTER(guidancePFH); END_COUNTER(guidancePFH);
}; };
private _timestep = diag_deltaTime * accTime; if (_showTrail) then {
drop [
"\a3\data_f\kouleSvetlo", "", "Billboard",
100,
0.03,
_projectile modelToWorld [0, 0, 0],
[0, 0, 0],
0,
1.25,
1,
0.05,
[0.5],
[TRAIL_COLOUR(1)],
[0],
0,
0,
"",
"",
"",
0,
false,
-1,
[TRAIL_COLOUR(10000)]
];
};
_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance", "_stabilityCoefficient"]; private _timestep = diag_deltaTime * accTime;
// Run seeker function: // Run seeker function:
private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState, _timestep] call FUNC(doSeekerSearch); private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState, _timestep] call FUNC(doSeekerSearch);

View File

@ -113,12 +113,15 @@ private _bangBang = false;
if (isNumber (_config >> "pitchRate")) then { if (isNumber (_config >> "pitchRate")) then {
_pitchRate = getNumber ( _config >> "pitchRate" ); _pitchRate = getNumber ( _config >> "pitchRate" );
_yawRate = getNumber ( _config >> "yawRate" ); _yawRate = getNumber ( _config >> "yawRate" );
_bangBang = 1 == getNumber (_config >> "bangBangGuidance"); _bangBang = (1 == getNumber (_config >> "bangBangGuidance"));
}; };
// How much this projectile likes to stay toward current velocity // How much this projectile likes to stay toward current velocity
private _stabilityCoefficient = getNumber (_config >> "stabilityCoefficient"); private _stabilityCoefficient = getNumber (_config >> "stabilityCoefficient");
// show a light trail in flight
private _showTrail = (1 == getNumber (_config >> "showTrail"));
private _navigationStateSubclass = _config >> "navigationStates"; private _navigationStateSubclass = _config >> "navigationStates";
private _states = getArray (_navigationStateSubclass >> "states"); private _states = getArray (_navigationStateSubclass >> "states");
@ -153,7 +156,8 @@ private _args = [_this,
_pitchRate, _pitchRate,
_yawRate, _yawRate,
_bangBang, _bangBang,
_stabilityCoefficient _stabilityCoefficient,
_showTrail
], ],
[ [
getNumber ( _config >> "seekerAngle" ), getNumber ( _config >> "seekerAngle" ),