mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Build out of penetration methods, debug export, and hit camera.
This commit is contained in:
parent
b4aead6bf7
commit
e8fc6dd3d2
@ -28,10 +28,13 @@ class CfgAmmo {
|
||||
GVAR(mass) = 4600; // grams, used if defined for penetrator, otherwise falls back on bulletMass
|
||||
|
||||
ACE_materialType = 2; // 0=tungsten,1=DU,2=hard steel alloy
|
||||
GVAR(materialType) = 2;
|
||||
ACE_materialDensity = 19100;
|
||||
GVAR(materialDensity) = 19100;
|
||||
|
||||
// Below densities are only used to override materialType,
|
||||
// OPTIONALS
|
||||
ACE_materialDensity = 19100;
|
||||
GVAR(density) = 19100; // kg/m3 used if defined for penetrator, otherwise falls back on ACE_materialDensity
|
||||
|
||||
|
||||
// This is ony used if defined, otherwise it is assumed the round is a cylinder
|
||||
GVAR(frustumLength) = 0.05; // meter
|
||||
|
@ -14,6 +14,8 @@ GVAR(ready) = false;
|
||||
|
||||
#ifdef DEBUG_LOG_EXTENSION
|
||||
GVAR(debug_log) = [];
|
||||
PREP(exportLogClipboard);
|
||||
PREP(exportLogFile);
|
||||
#endif
|
||||
#ifdef DEBUG_EXTENSION_DYNLOAD
|
||||
// This value is used for debug loading of the extension with dynload
|
||||
@ -45,32 +47,7 @@ FUNC(_textVector) = {
|
||||
};
|
||||
|
||||
#ifdef DEBUG_LOG_EXTENSION
|
||||
FUNC(clipboardExport) = {
|
||||
private["_chunks"];
|
||||
_chunks = [];
|
||||
|
||||
_chunks = [_this select 0, ";"] call CBA_fnc_split;
|
||||
|
||||
{
|
||||
private["_chunk"];
|
||||
_chunk = _x + ";";
|
||||
"ace_clipboard" callExtension format["%1", _chunk];
|
||||
} forEach _chunks;
|
||||
|
||||
"ace_clipboard" callExtension "--COMPLETE--";
|
||||
};
|
||||
FUNC(exportLog) = {
|
||||
private["_chunks"];
|
||||
_chunks = [str(_this select 0), ","] call CBA_fnc_split;
|
||||
|
||||
{
|
||||
private["_chunk"];
|
||||
_chunk = _x + ";";
|
||||
"ace_clipboard" callExtension format["%1", _chunk];
|
||||
} forEach _chunks;
|
||||
|
||||
"ace_clipboard" callExtension "--COMPLETE--";
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -13,25 +13,31 @@ _impactSurfaceType = (_this select 0) select 9;
|
||||
_isDirectHit = (_this select 0) select 10;
|
||||
TRACE_2("",_impactSurfaceType,_isDirectHit);
|
||||
|
||||
_projectileType = (getNumber (__PROJECTILE_CLASS >> "ACE_projectileType") );
|
||||
_projectileType = getNumber (__PROJECTILE_CLASS >> "ACE_projectileType");
|
||||
|
||||
_projectileDensity = getNumber (__PROJECTILE_CLASS >> "ACE_bulletDensity");
|
||||
_projectileLength = (getNumber (__PROJECTILE_CLASS >> "ACE_bulletLength") ) * 1000; // fucking inches dafuq!?!?!?
|
||||
_projectileDiameter = (getNumber (__PROJECTILE_CLASS >> "ACE_caliber") ) * 1000; // fucking inches dafuq!?!?!?
|
||||
_projectileDensity = getNumber (__PROJECTILE_CLASS >> "ace_penetration_materialDensity");
|
||||
_projectileMaterialType = getNumber (__PROJECTILE_CLASS >> "ace_penetration_materialType");
|
||||
|
||||
_projectileLength = (getNumber (__PROJECTILE_CLASS >> "ace_penetration_length")) * 1000; // fucking inches dafuq!?!?!?
|
||||
_projectileDiameter = (getNumber (__PROJECTILE_CLASS >> "ace_penetration_diameter") ) * 1000; // fucking inches dafuq!?!?!?
|
||||
_projectileCaliber = getNumber (__PROJECTILE_CLASS >> "caliber");
|
||||
|
||||
_frastumLength = (getNumber (__PROJECTILE_CLASS >> "ACE_frastumLength") ) * 1000;
|
||||
_frastumDiameter = (getNumber (__PROJECTILE_CLASS >> "ACE_frastumDiameter") ) * 1000;
|
||||
_frastumLength = (getNumber (__PROJECTILE_CLASS >> "ace_penetration_frustumLength") ) * 1000;
|
||||
_frastumDiameter = (getNumber (__PROJECTILE_CLASS >> "ace_penetration_frustumDiameter") ) * 1000;
|
||||
|
||||
_model = getText (__VEHICLE_CLASS >> "model");
|
||||
|
||||
TRACE_4("Measurements", _projectileDensity,_projectileLength,_projectileDiameter,_projectileCaliber);
|
||||
TRACE_5("Measurements", _projectileDensity,_projectileLength,_projectileDiameter,_projectileCaliber, _projectileMaterialType);
|
||||
|
||||
// If there was no ACE length defined, default to caliber
|
||||
if(_projectileLength == 0) then {
|
||||
_projectileLength = ACE_BASE_BULLET_LENGTH * _projectileCaliber; // Length in mm, 1 caliber = 55.6 = ~13mm length round
|
||||
};
|
||||
|
||||
// @TODO: WHERE DO WE LOAD THESE FROM!?!?!?!
|
||||
_impactSurfaceDensity = 7840;
|
||||
_impactSurfaceMaterialType = 2;
|
||||
|
||||
_vehicleId = _vehicle getVariable[QGVAR(id), -1];
|
||||
|
||||
|
||||
@ -44,28 +50,36 @@ _projectilePosition = _vehicle worldToModelVisual (position _projectile);
|
||||
|
||||
_relProjectilePos = (position _projectile) vectorAdd (velocity _projectile);
|
||||
_relProjectileVelocity = _projectilePosition vectorFromTo (_vehicle modelToWorldVisual _relProjectilePos);
|
||||
_relProjectileVelocity = _relProjectileVelocity vectorMultiply (vectorMagnitude (velocity _projectile));
|
||||
|
||||
_relImpactVelPos = _impactPosition vectorAdd _impactVelocity;
|
||||
_relImpactVelocity = _relImpactPosition vectorFromTo (_vehicle modelToWorldVisual _relImpactVelPos);
|
||||
_relImpactVelocity = _relImpactVelocity vectorMultiply (vectorMagnitude _impactVelocity);
|
||||
|
||||
_relSurfDirectionPos = _impactPosition vectorAdd _surfaceDirection;
|
||||
_relSurfaceDirection = _relImpactPosition vectorFromTo (_vehicle modelToWorldVisual _relSurfDirectionPos);
|
||||
|
||||
_command = format["hit:%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18",
|
||||
TRACE_2("", (vectorMagnitude _relImpactVelocity), (vectorMagnitude _relProjectileVelocity));
|
||||
TRACE_2("", (vectorMagnitude _impactVelocity), (vectorMagnitude (velocity _projectile)));
|
||||
|
||||
_command = format["hit:%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22",
|
||||
_vehicleId, // vehicle id registered
|
||||
// _model, _selection,
|
||||
_model, "BALLS",
|
||||
VECTOR_TEXT(vectorDir _vehicle),
|
||||
VECTOR_TEXT(vectorUp _vehicle),
|
||||
_projectileType, //projectile type id
|
||||
(_ammo select 4), _projectileLength, _projectileDiameter, _projectileDensity,
|
||||
(_ammo select 4), _projectileLength, _projectileDiameter, _projectileDensity, _projectileMaterialType,
|
||||
_frastumLength, _frastumDiameter,
|
||||
VECTOR_TEXT(_relProjectileVelocity),
|
||||
VECTOR_TEXT(_projectilePosition),
|
||||
VECTOR_TEXT(vectorDir _projectile),
|
||||
VECTOR_TEXT(_relSurfaceDirection),
|
||||
VECTOR_TEXT(_relImpactPosition),
|
||||
VECTOR_TEXT(_relImpactVelocity)
|
||||
VECTOR_TEXT(_relImpactVelocity),
|
||||
_impactSurfaceType,
|
||||
_impactSurfaceDensity,
|
||||
_impactSurfaceMaterialType
|
||||
];
|
||||
TRACE_1("", _command);
|
||||
_result = _command call FUNC(callExtension);
|
||||
|
19
addons/vehicledamage/functions/fnc_exportLogClipboard.sqf
Normal file
19
addons/vehicledamage/functions/fnc_exportLogClipboard.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
#include "script_component.hpp"
|
||||
private["_chunks", "_logString"];
|
||||
_chunks = [];
|
||||
|
||||
if((count _this) < 1) then {
|
||||
_logString = str GVAR(debug_log);
|
||||
} else {
|
||||
_logString = _this select 0;
|
||||
};
|
||||
|
||||
_chunks = [_logString, ";"] call CBA_fnc_split;
|
||||
|
||||
{
|
||||
private["_chunk"];
|
||||
_chunk = _x + ";";
|
||||
"ace_clipboard" callExtension format["%1", _chunk];
|
||||
} forEach _chunks;
|
||||
|
||||
"ace_clipboard" callExtension "--COMPLETE--";
|
3
addons/vehicledamage/functions/fnc_exportLogFile.sqf
Normal file
3
addons/vehicledamage/functions/fnc_exportLogFile.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
private["_chunks"];
|
||||
|
@ -223,9 +223,9 @@ animation_transform ace::simulation::animation::animate(const float phase, const
|
||||
//rotation
|
||||
case 0: {
|
||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), -axis_position);
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||
animation_matrix *= glm::rotate(glm::mat4(1.0f), -scale, axis_direction);
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f), axis_position);
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f), -axis_position);
|
||||
break;
|
||||
}
|
||||
//rotationX
|
||||
@ -234,27 +234,27 @@ animation_transform ace::simulation::animation::animate(const float phase, const
|
||||
|
||||
glm::vec3 rotation_axis = glm::vec3(1.0f, 0.0f, 0.0f);
|
||||
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), -axis_position);
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||
animation_matrix *= glm::rotate(glm::mat4(1.0f), -scale, rotation_axis);
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f),axis_position);
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f),-axis_position);
|
||||
break;
|
||||
}
|
||||
//rotationY
|
||||
case 2: {
|
||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||
glm::vec3 rotation_axis = glm::vec3(0.0f, 1.0f, 0.0f);
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), -axis_position);
|
||||
animation_matrix *= glm::rotate(glm::mat4(1.0f), -scale, rotation_axis);
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f), axis_position);
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||
animation_matrix *= glm::rotate(glm::mat4(1.0f), scale, rotation_axis); // should this be positive?
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f), -axis_position);
|
||||
break;
|
||||
}
|
||||
//rotationZ
|
||||
case 3: {
|
||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||
glm::vec3 rotation_axis = glm::vec3(0.0f, 0.0f, 1.0f);
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), -axis_position);
|
||||
animation_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||
animation_matrix *= glm::rotate(glm::mat4(1.0f), -scale, rotation_axis);
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f), axis_position);
|
||||
animation_matrix *= glm::translate(glm::mat4(1.0f), -axis_position);
|
||||
break;
|
||||
}
|
||||
//translation
|
||||
@ -320,16 +320,16 @@ float ace::simulation::animation::get_scale(float phase)
|
||||
|
||||
switch (source_address)
|
||||
{
|
||||
case 1:
|
||||
scale = fmod(phase - min_value, (max_value - min_value) * 2) + min_value;
|
||||
case 1: // LOOP
|
||||
scale = fmod(phase - min_value, (max_value - min_value)) + min_value;
|
||||
// when over limit, mirror
|
||||
if (phase > max_value) phase = max_value - (phase - max_value);
|
||||
|
||||
scale = std::min(std::max(scale, min_phase), max_phase);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
scale = fmod(phase - min_value, (max_value - min_value)) + min_value;
|
||||
case 2: // MIRROR
|
||||
scale = fmod(phase - min_value, (max_value - min_value) * 2) + min_value;
|
||||
if (scale > max_value) scale = max_value - (scale - max_value);
|
||||
scale = std::min(std::max(scale, min_phase), max_phase);
|
||||
break;
|
||||
|
6
extensions/tests/REAL_AT_01.txt
Normal file
6
extensions/tests/REAL_AT_01.txt
Normal file
@ -0,0 +1,6 @@
|
||||
#c:\arma\arma3\addons\static_f_gamma.pbo C:\dev\ace3\extensions\tests\REAL_AT_01.txt
|
||||
init:
|
||||
debug_render:
|
||||
register_vehicle:\A3\Static_F_gamma\AT_01\AT_01.p3d,0,4050.18;3802.55;5.075
|
||||
#set_animation_state:0, MainTurret, 0, MainGun, 0, MainTurret_destructX, 0, MainTurret_destructY, 0, MainTurret_destructZ, 0, MainGun_destructX, 0, MainGun_destructY, 0, MainGun_destructZ, 0, magazine_destruct, 0, ammo_belt_destruct, 0, bolt_destruct, 0, charging_handle_destruct, 0, damagehideVez_destruct, 0, damagehideHlaven_destruct, 0, damagehideRecoil_destruct, 0, Turret_shake, 0, Turret_shake_aside, 0, Magazine_hide, 0, Ammo_belt_hide, 0, muzzleFlash, 0, AddAutonomous_unhide, 0, bullet001_reload_hide, 0, bullet002_reload_hide, 0, bullet003_reload_hide, 0, bullet004_reload_hide, 0, bullet005_reload_hide, 0, bullet006_reload_hide, 0, bullet007_reload_hide, 0, bullet008_reload_hide, 0
|
||||
set_animation_state:0, MainTurret, -0, MainGun, 1, MainTurret_destructX, 0, MainTurret_destructY, 0, MainTurret_destructZ, 0, MainGun_destructX, 0, MainGun_destructY, 0, MainGun_destructZ, 0, magazine_destruct, 0, ammo_belt_destruct, 0, bolt_destruct, 0, charging_handle_destruct, 0, damagehideVez_destruct, 0, damagehideHlaven_destruct, 0, damagehideRecoil_destruct, 0, Turret_shake, 0, Turret_shake_aside, 0, Magazine_hide, 0, Ammo_belt_hide, 0, muzzleFlash, 0, AddAutonomous_unhide, 0, bullet001_reload_hide, 0, bullet002_reload_hide, 0, bullet003_reload_hide, 0, bullet004_reload_hide, 0, bullet005_reload_hide, 0, bullet006_reload_hide, 0, bullet007_reload_hide, 0, bullet008_reload_hide, 0
|
1
extensions/tests/anim_test/$PBOPREFIX$
Normal file
1
extensions/tests/anim_test/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
x\nou\addons\anim_test
|
@ -1,6 +0,0 @@
|
||||
///////<HEADER>///////
|
||||
prefix=z\ace\test
|
||||
Mikero=DePbo.dll
|
||||
Pbo Type is: Arma Addon
|
||||
Sha: 'B57F52A263D29E93AC869A50E7058065B93F97D5'
|
||||
//////</HEADER>//////
|
@ -2,17 +2,7 @@
|
||||
init:
|
||||
debug_render:
|
||||
register_vehicle:\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, 1, 4046.21;3902.56;5.075
|
||||
#set_animation_state:1,damageHide, 0, Wheel_kolL1, 0, Wheel_koloL1, 0, Wheel_podkoloL1, 1, Wheel_kolP1, 0, Wheel_koloP1, 0, Wheel_podkoloP1, 1, Wheel_kolL2, 0, Wheel_kolP2, 0, Wheel_koloL2, 0, Wheel_koloL3, 0, Wheel_koloL4, 0, Wheel_koloL5, 0, Wheel_koloL6, 0, Wheel_koloL7, 0, Wheel_koloP2, 0, Wheel_koloP3, 0, Wheel_koloP4, 0, Wheel_koloP5, 0, Wheel_koloP6, 0, Wheel_koloP7, 0, Wheel_podkoloL2, 1, Wheel_podkoloL3, 1, Wheel_podkoloL4, 1, Wheel_podkoloL5, 0, Wheel_podkoloL6, 0, Wheel_podkoloP2, 1, Wheel_podkoloP3, 1, Wheel_podkoloP4, 1, Wheel_podkoloP5, 0, Wheel_podkoloP6, 1, podkoloL1_hide_damage, 0, podkoloL2_hide_damage, 0, podkoloL3_hide_damage, 0, podkoloL4_hide_damage, 0, podkoloL5_hide_damage, 0, podkoloL6_hide_damage, 0, podkoloL7_hide_damage, 0, podkoloL8_hide_damage, 0, podkoloP1_hide_damage, 0, podkoloP2_hide_damage, 0, podkoloP3_hide_damage, 0, podkoloP4_hide_damage, 0, podkoloP5_hide_damage, 0, podkoloP6_hide_damage, 0, podkoloP7_hide_damage, 0, podkoloP8_hide_damage, 0, damageVez, 0, MainTurret, -3, MainGun, 0, Recoil, 0, ObsTurret, -0, ObsGun, 0, MainGunOptics, 0, Wheel_podkoloP7, 0, Wheel_podkoloL7, 0, HatchDriver, 0, HatchCommander, 0, HatchGunner, 0, damageVezVelitele, 0, poklop_commander_damage, 0, poklop_gunner_damage, 0, poklop_driver_damage, 0, zaslehROT_HMG, 101, zaslehROT_coax, 16, cannon_muzzle_flash, 0, zaslehROT_cannon, 956, HideHull, 1, HideTurret, 1, LockMuzzle, 0
|
||||
set_animation_state:1,damageHide, 0, Wheel_kolL1, 0, Wheel_koloL1, 0, Wheel_podkoloL1, 1, Wheel_kolP1, 0, Wheel_koloP1, 0, Wheel_podkoloP1, 1, Wheel_kolL2, 0, Wheel_kolP2, 0, Wheel_koloL2, 0, Wheel_koloL3, 0, Wheel_koloL4, 0, Wheel_koloL5, 0, Wheel_koloL6, 0, Wheel_koloL7, 0, Wheel_koloP2, 0, Wheel_koloP3, 0, Wheel_koloP4, 0, Wheel_koloP5, 0, Wheel_koloP6, 0, Wheel_koloP7, 0, Wheel_podkoloL2, 1, Wheel_podkoloL3, 1, Wheel_podkoloL4, 1, Wheel_podkoloL5, 0, Wheel_podkoloL6, 0, Wheel_podkoloP2, 1, Wheel_podkoloP3, 1, Wheel_podkoloP4, 1, Wheel_podkoloP5, 0, Wheel_podkoloP6, 1, podkoloL1_hide_damage, 0, podkoloL2_hide_damage, 0, podkoloL3_hide_damage, 0, podkoloL4_hide_damage, 0, podkoloL5_hide_damage, 0, podkoloL6_hide_damage, 0, podkoloL7_hide_damage, 0, podkoloL8_hide_damage, 0, podkoloP1_hide_damage, 0, podkoloP2_hide_damage, 0, podkoloP3_hide_damage, 0, podkoloP4_hide_damage, 0, podkoloP5_hide_damage, 0, podkoloP6_hide_damage, 0, podkoloP7_hide_damage, 0, podkoloP8_hide_damage, 0, damageVez, 0, MainTurret, -3, MainGun, 0, Recoil, 0, ObsTurret, -0, ObsGun, 0, MainGunOptics, 0, Wheel_podkoloP7, 0, Wheel_podkoloL7, 0, HatchDriver, 0, HatchCommander, 0, HatchGunner, 0, damageVezVelitele, 0, poklop_commander_damage, 0, poklop_gunner_damage, 0, poklop_driver_damage, 0, zaslehROT_HMG, 101, zaslehROT_coax, 16, cannon_muzzle_flash, 0, zaslehROT_cannon, 956, HideHull, 1, HideTurret, 1, LockMuzzle, 0
|
||||
#set_vehicle_state:1,0;-20;0,0;0;0,0;0;0
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984808;0.173648;-0.000321539, 0.000336425;-5.62874e-005;1, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 0.000173648;-0.000984808;-1.13852e-007, 1.90674;-2.97705;-1.01589, 9.3088e-005;0.999998;0.00182291, 0.997565;0.0697389;0.00040539, 2.1709;-3.00732;3.9504, 0.996985;0.0775994;0.000355178
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984808;0.173648;-0.000321539, 0.000336425;-5.62874e-005;1, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 0.000173648;-0.000984808;-1.13852e-007, 1.90674;-2.97705;-1.01589, 9.3088e-005;0.999998;0.00182291, 0.997565;0.0697387;0.000405358, 1.90527;-2.97852;3.94798, 0.997251;0.0740926;0.000152842
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00285841, 0.00294448;-0.000238045;0.999996, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 7.61759e-005;-0.000997094;-4.61654e-007, 1.77954;-2.83154;-0.219069, -0.0380967;0.999228;0.00961505, 0.997566;0.069721;-0.00105282, 1.7749;-2.8457;4.74479, 0.996762;0.0804012;-0.000602539
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284932, 0.00294109;-0.000271166;0.999995, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 0.000173647;-0.000984808;-7.73569e-007, 1.82178;-1.9292;-0.268372, -0.0288651;0.999542;0.00905338, 0.997581;0.0695041;-0.00106295, 1.81689;-1.94336;4.69548, 0.996832;0.079526;-0.000653841
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284391, 0.00293735;-0.000281132;0.999996, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 0.000173647;-0.000984808;-7.85849e-007, 1.84595;-2.57471;-2.50434, -0.0354257;0.999277;-0.0138109, 0.997571;0.0696509;-0.00106625, 1.84106;-2.58887;2.45951, 0.99678;0.0801495;-0.00236906
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284275, 0.00293741;-0.000288139;0.999996, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 0.000173647;-0.000984808;-7.92519e-007, 1.90674;-2.85693;-0.816221, -0.0381079;0.999267;0.00357182, 0.997566;0.069714;-0.00106831, 2.16724;-2.90381;4.15556, 0.996761;0.08041;-0.00106769
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284275, 0.00293741;-0.000288139;0.999996, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 0.000173647;-0.000984808;-7.92519e-007, 1.90674;-2.85693;-0.816221, -0.0381079;0.999267;0.00357182, 0.997566;0.0697129;-0.00106831, 1.90186;-2.87109;4.14763, 0.997275;0.0737539;-0.00188146
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.002843, 0.00293819;-0.000291138;0.999996, 0, B_65x39_Caseless, 32893, 6706, 11300, 0, 0, 0.000173647;-0.000984808;-7.95372e-007, 1.67578;-2.15332;-2.30106, -0.0313568;0.99944;-0.0117081, 0.997577;0.0695593;-0.00107051, 1.6709;-2.16797;2.6628, 0.996812;0.0797612;-0.00221558
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284299, 0.00293839;-0.0002923;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -94.1198;1574.74;-13.4215, -3.81567;-2.31543;-0.841839, -0.0666772;0.997769;-0.00347184, 0.997565;0.0697371;-0.00107085, 2.16748;-3.00537;4.17418, 0.995139;0.0984623;-0.00199962
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284299, 0.00293839;-0.0002923;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -94.1198;1574.74;-13.4215, -3.81567;-2.31543;-0.841839, -0.0666772;0.997769;-0.00347184, 0.997565;0.069737;-0.00107086, 1.90186;-2.97705;4.17292, 0.995158;0.0982686;-0.00206677
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284299, 0.00293839;-0.0002923;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -94.1198;1574.74;-13.4215, -3.81567;-2.31543;-0.841839, -0.0666772;0.997769;-0.00347184, 0.997565;0.0697312;-0.00107094, -1.75977;-2.56689;4.15401, 0.995311;0.0967058;-0.00210695
|
||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, BALLS, 0.984803;0.173649;-0.00284299, 0.00293839;-0.0002923;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -94.1198;1574.74;-13.4215, -3.81567;-2.31543;-0.841839, -0.0666772;0.997769;-0.00347184, 0.997565;0.0697306;-0.00107095, -2.08813;-2.5293;4.15127, 0.995439;0.0953656;-0.00261482
|
||||
hit:1,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984803;0.173649;-0.00285841,0.0029445;-0.000238176;0.999996,2,Sh_120mm_APFSDS_Tracer_Yellow,65,27,19100,2,50,10,0.995217;0.0976774;-0.00161879,-2.42871;-2.42871;-0.794659,-0.0660895;0.997809;-0.00319795,0.997566;0.0697239;-0.00105289,2.16772;-2.94727;4.19943,0.99515;0.0983533;-0.00194169,A3\data_f\Penetration\armour_plate_7mm.bisurf,7840,2
|
||||
hit:1,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984803;0.173649;-0.00285841,0.0029445;-0.000238176;0.999996,2,Sh_120mm_APFSDS_Tracer_Yellow,65,27,19100,2,50,10,0.995217;0.0976774;-0.00161879,-2.42871;-2.42871;-0.794659,-0.0660895;0.997809;-0.00319795,0.997566;0.0697195;-0.00105303,-2.08813;-2.48047;4.18355,0.995188;0.0979676;-0.00189929,A3\data_f\Penetration\armour_plate_7mm.bisurf,7840,2
|
@ -20,7 +20,7 @@ namespace ace {
|
||||
}
|
||||
}
|
||||
if (fire_lod == -1) // @TODO: fallback on geo LOD
|
||||
fire_lod = 0;
|
||||
fire_lod = 11;
|
||||
//fire_lod = 0;
|
||||
assert(fire_lod != -1);
|
||||
|
||||
|
@ -196,7 +196,7 @@ namespace ace {
|
||||
}
|
||||
|
||||
bool controller::handle_hit(const arguments &_args, std::string & result) {
|
||||
if (_args.size() < 18) return false;
|
||||
if (_args.size() < 22) return false;
|
||||
|
||||
auto _vehicle = vehicles.find(_args[0]);
|
||||
if (_vehicle == vehicles.end())
|
||||
|
@ -64,14 +64,14 @@ namespace ace {
|
||||
|
||||
class projectile {
|
||||
public:
|
||||
projectile(uint32_t projtypeid_, const std::string & classname_, float length_, float diameter_, float density_, float frustum_length_, float frustum_diameter_,
|
||||
projectile(uint32_t projtypeid_, const std::string & classname_, float length_, float diameter_, float material_density_, int material_type_, float frustum_length_, float frustum_diameter_,
|
||||
ace::vector3<float> vel, ace::vector3<float> pos, ace::vector3<float> dir) :
|
||||
type(PROJECTILE_TYPE(projtypeid_)), classname(classname_), length(length_), diameter(diameter_), density(density_), frustum_length(frustum_length_), frustum_diameter(frustum_diameter_),
|
||||
type(PROJECTILE_TYPE(projtypeid_)), classname(classname_), length(length_), diameter(diameter_), material_density(material_density_), material_type(material_type_), frustum_length(frustum_length_), frustum_diameter(frustum_diameter_),
|
||||
velocity(vel), position(pos), direction(dir)
|
||||
{}
|
||||
|
||||
projectile & operator= (const projectile& other) {
|
||||
type = other.type; classname = other.classname; length = other.length; diameter = other.diameter, density = other.density;
|
||||
type = other.type; classname = other.classname; length = other.length; diameter = other.diameter, material_density = other.material_density; material_type = other.material_type;
|
||||
frustum_length = other.frustum_length; frustum_diameter = other.frustum_diameter;
|
||||
velocity = other.velocity; position = other.position; direction = other.direction;
|
||||
return *this;
|
||||
@ -83,7 +83,9 @@ namespace ace {
|
||||
|
||||
float length;
|
||||
float diameter;
|
||||
float density;
|
||||
|
||||
float material_density;
|
||||
int material_type;
|
||||
|
||||
float frustum_diameter;
|
||||
float frustum_length;
|
||||
@ -102,20 +104,22 @@ namespace ace {
|
||||
const std::string & classname, const std::string & selection,
|
||||
ace::vector3<float> dir, ace::vector3<float> up,
|
||||
projectile proj,
|
||||
ace::vector3<float> orthosurface, ace::vector3<float> impactpos, ace::vector3<float> impactvel)
|
||||
ace::vector3<float> orthosurface, ace::vector3<float> impactpos, ace::vector3<float> impactvel, std::string bisurf_, float material_density_, int material_type_)
|
||||
: id(id), objectid(objectid),
|
||||
classname(classname), selection(selection),
|
||||
vehicle_direction(dir), vehicle_up(up),
|
||||
projectile(proj),
|
||||
surface(orthosurface), impactposition(impactpos), impactvelocity(impactvel)
|
||||
surface(orthosurface), impactposition(impactpos), impactvelocity(impactvel), bisurf(bisurf_),
|
||||
material_density(material_density_), material_type(material_type_)
|
||||
{}
|
||||
|
||||
#define PROJ_ARG_COUNT 16
|
||||
static std::shared_ptr<gamehit> create(const arguments & args) {
|
||||
return std::make_shared<gamehit>(-1, args.as_uint32(0), args.as_string(1), args.as_string(2),
|
||||
args[3], args[4],
|
||||
ace::vehicledamage::projectile(args.as_uint32(5), args.as_string(6), args.as_float(7), args.as_float(8), args[9], args[10], args[11],
|
||||
args.as_vector(12), args[13], args.as_vector(14)),
|
||||
args.as_vector(15), args.as_vector(16), args.as_vector(17));
|
||||
ace::vehicledamage::projectile(args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12],
|
||||
args[13], args[14], args[15]),
|
||||
args.as_vector(PROJ_ARG_COUNT), args.as_vector(PROJ_ARG_COUNT+1), args.as_vector(PROJ_ARG_COUNT+2), args[PROJ_ARG_COUNT+3],
|
||||
args[PROJ_ARG_COUNT + 4], args[PROJ_ARG_COUNT + 5]);
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
@ -130,9 +134,13 @@ namespace ace {
|
||||
ace::vector3<float> vehicle_up;
|
||||
|
||||
ace::vector3<float> surface;
|
||||
std::string bisurf;
|
||||
|
||||
ace::vector3<float> impactposition;
|
||||
ace::vector3<float> impactvelocity;
|
||||
|
||||
int material_type;
|
||||
float material_density;
|
||||
};
|
||||
typedef std::shared_ptr<gamehit> gamehit_p;
|
||||
}
|
||||
|
19
extensions/vd/penetration/basic.cpp
Normal file
19
extensions/vd/penetration/basic.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "basic.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
namespace ace {
|
||||
namespace vehicledamage {
|
||||
namespace penetration {
|
||||
bool basic::process() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
14
extensions/vd/penetration/basic.hpp
Normal file
14
extensions/vd/penetration/basic.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "penetration.hpp"
|
||||
|
||||
namespace ace {
|
||||
namespace vehicledamage {
|
||||
namespace penetration {
|
||||
class basic : public base_penetration_model {
|
||||
public:
|
||||
bool process() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -63,36 +63,34 @@ namespace ace {
|
||||
float m = -0.224;
|
||||
|
||||
float Lw = _working_length();
|
||||
float impact_velocity = _hit->projectile.velocity.magnitude() / 1000;
|
||||
ace::vector3<float> vel_norm = _hit->projectile.velocity.normalize();
|
||||
float impact_velocity = _hit->impactvelocity.magnitude();
|
||||
ace::vector3<float> vel_norm = _hit->impactvelocity.normalize();
|
||||
ace::vector3<float> surface_norm = _hit->surface.normalize();
|
||||
float impact_angle = surface_norm.dot(vel_norm);
|
||||
|
||||
uint32_t material_index = 2;
|
||||
float targetHardness = material_properties[_hit->material_type][0];
|
||||
float projectileHardness = material_properties[_hit->projectile.material_type][0];
|
||||
float target_density = material_properties[_hit->material_type][1];
|
||||
|
||||
float targetHardness = material_properties[material_index][0];
|
||||
float projectileHardness = material_properties[material_index][0];
|
||||
float target_density = material_properties[material_index][1];
|
||||
|
||||
float a = material_coefficients[material_index][0];
|
||||
float c0 = material_coefficients[material_index][1];
|
||||
float c1 = material_coefficients[material_index][2];
|
||||
float k = material_coefficients[material_index][3];
|
||||
float n = material_coefficients[material_index][4];
|
||||
float a = material_coefficients[_hit->projectile.material_type][0];
|
||||
float c0 = material_coefficients[_hit->projectile.material_type][1];
|
||||
float c1 = material_coefficients[_hit->projectile.material_type][2];
|
||||
float k = material_coefficients[_hit->projectile.material_type][3];
|
||||
float n = material_coefficients[_hit->projectile.material_type][4];
|
||||
|
||||
float s2 = 0;
|
||||
|
||||
if (material_index < 2) {
|
||||
s2 = (c0 + c1 * targetHardness) * targetHardness / _hit->projectile.density;
|
||||
if (_hit->projectile.material_type < 2) {
|
||||
s2 = (c0 + c1 * targetHardness) * targetHardness / _hit->projectile.material_density;
|
||||
} else {
|
||||
s2 = c0 * (std::pow(projectileHardness, k)) * (std::pow(targetHardness, n)) / _hit->projectile.density;
|
||||
s2 = c0 * (std::pow(projectileHardness, k)) * (std::pow(targetHardness, n)) / _hit->projectile.material_density;
|
||||
};
|
||||
|
||||
float tanX = b0 + b1 * (Lw / _hit->projectile.diameter);
|
||||
|
||||
float w = 1 / std::tanh(tanX);
|
||||
float x = std::pow(std::cos(impact_angle), m);
|
||||
float y = sqrt(_hit->projectile.density / target_density);
|
||||
float y = sqrt(_hit->projectile.material_density / target_density);
|
||||
float z = std::pow(std::exp(1), (-(s2) / std::pow(impact_velocity, 2)));
|
||||
|
||||
float P = a * w * x * y * z;
|
||||
|
Loading…
Reference in New Issue
Block a user