mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Impact position alignment, velocity and flipping.
This commit is contained in:
parent
9a566451cf
commit
d25144e75a
@ -49,12 +49,11 @@ _relImpactPosition = _vehicle worldToModelVisual _impactPosition;
|
||||
_projectilePosition = _vehicle worldToModelVisual (position _projectile);
|
||||
|
||||
_relProjectilePos = (position _projectile) vectorAdd (velocity _projectile);
|
||||
_relProjectileVelocity = _projectilePosition vectorFromTo (_vehicle modelToWorldVisual _relProjectilePos);
|
||||
_relProjectileVelocity = _relProjectileVelocity vectorMultiply (vectorMagnitude (velocity _projectile));
|
||||
_relProjectileVelocityDir = (_vehicle worldToModelVisual (position _projectile) vectorFromTo (_vehicle worldToModelVisual ((position _projectile) vectorAdd (velocity _projectile))));
|
||||
_relProjectileVelocity = _relProjectileVelocityDir vectorMultiply (vectorMagnitude (velocity _projectile));
|
||||
|
||||
_relImpactVelPos = _impactPosition vectorAdd _impactVelocity;
|
||||
_relImpactVelocity = _relImpactPosition vectorFromTo (_vehicle modelToWorldVisual _relImpactVelPos);
|
||||
_relImpactVelocity = _relImpactVelocity vectorMultiply (vectorMagnitude _impactVelocity);
|
||||
_relImpactVelocityDir = (_vehicle worldToModelVisual _impactPosition) vectorFromTo (_vehicle worldToModelVisual (_impactPosition vectorAdd _impactvelocity));
|
||||
_relImpactVelocity = _relImpactVelocityDir vectorMultiply (vectorMagnitude _impactVelocity);
|
||||
|
||||
_relSurfDirectionPos = _impactPosition vectorAdd _surfaceDirection;
|
||||
_relSurfaceDirection = _relImpactPosition vectorFromTo (_vehicle modelToWorldVisual _relSurfDirectionPos);
|
||||
@ -62,6 +61,9 @@ _relSurfaceDirection = _relImpactPosition vectorFromTo (_vehicle modelToWorldVis
|
||||
TRACE_2("", (vectorMagnitude _relImpactVelocity), (vectorMagnitude _relProjectileVelocity));
|
||||
TRACE_2("", (vectorMagnitude _impactVelocity), (vectorMagnitude (velocity _projectile)));
|
||||
|
||||
TRACE_2("", _relProjectilePos, _relProjectileVelocity);
|
||||
TRACE_2("", _relImpactPosition, _relImpactVelocity);
|
||||
|
||||
_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,
|
||||
@ -72,7 +74,7 @@ _command = format["hit:%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%1
|
||||
(_ammo select 4), _projectileLength, _projectileDiameter, _projectileDensity, _projectileMaterialType,
|
||||
_frastumLength, _frastumDiameter,
|
||||
VECTOR_TEXT(_relProjectileVelocity),
|
||||
VECTOR_TEXT(_projectilePosition),
|
||||
VECTOR_TEXT(_relProjectilePos),
|
||||
VECTOR_TEXT(vectorDir _projectile),
|
||||
VECTOR_TEXT(_relSurfaceDirection),
|
||||
VECTOR_TEXT(_relImpactPosition),
|
||||
@ -84,3 +86,27 @@ _command = format["hit:%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%1
|
||||
TRACE_1("", _command);
|
||||
_result = _command call FUNC(callExtension);
|
||||
TRACE_1("", _result);
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
|
||||
// If its in debug mode, draw the hits
|
||||
[{
|
||||
private["_derp", "_toLine", "_params"];
|
||||
_params = _this select 0;
|
||||
_vehicle = _params select 0;
|
||||
_impactPosition = _params select 1;
|
||||
_impactVelocity = _params select 2;
|
||||
_relImpactPosition = _params select 3;
|
||||
_relImpactVelocity = _params select 4;
|
||||
|
||||
_toLine = _impactPosition vectorDiff _impactVelocity;
|
||||
drawLine3D [(ASLtoATL _impactPosition), (ASLtoATL _toLine), [1,0,0,1]];
|
||||
|
||||
// Reverse the relatives
|
||||
_derp = _vehicle modelToWorldVisual _relImpactPosition;
|
||||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\select_target_ca.paa", [1,0,0,1], (ASLToATL _derp), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"];
|
||||
}, 0,
|
||||
[_vehicle, _impactPosition, _impactVelocity, _relImpactPosition, _relImpactVelocity]
|
||||
] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
#endif
|
@ -1,8 +1,12 @@
|
||||
#c:\arma\arma3\addons\armor_f_epb.pbo C:\dev\ace3\extensions\tests\longrod_dxtk_test.txt
|
||||
init:
|
||||
debug_render:
|
||||
register_vehicle:\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, 1, 4046.21;3902.56;5.075
|
||||
register_vehicle:\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,0,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_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.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
|
||||
hit:0,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984808;0.173648;-9.67739e-005,0.000103005;-2.68742e-005;1,0,B_65x39_Caseless,32.893,0,0,0,0,0,0.001;0;0,4046.19;3900.32;1.47459,9.73272e-006;0.999999;0.00125668,0.997606;0.0691489;0.00058213,2.19238;-0.410645;3.81808,-738.696;130.259;0.883384,A3\data_f\Penetration\armour_plate_80mm.bisurf,7840,2
|
||||
hit:0,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984803;0.173649;-0.00289258,0.00297637;-0.000222168;0.999996,0,B_65x39_Caseless,32.893,0,0,0,0,0,0.000928477;0.000371391;0,4044.82;3900.08;0.831421,-0.27397;0.948438;-0.159396,0.997584;0.0694653;-0.00106395,2.18848;-1.80859;3.24482,-736.495;-78.5283;-120.43,A3\data_f\Penetration\armour_plate_80mm.bisurf,7840,2
|
||||
hit:0,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984803;0.173649;-0.00285147,0.00294435;-0.000277319;0.999995,0,B_65x39_Caseless,32.893,0,0,0,0,0,0;0;0.001,4044.17;3900.52;1.2967,-0.1391;0.989408;-0.0415161,0.997575;0.0695936;-0.00106835,2.16748;-2.37305;3.74579,-748.989;26.2104;-31.7038,A3\data_f\Penetration\armour_plate_7mm.bisurf,7840,2
|
||||
hit:0,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984803;0.173649;-0.00285147,0.00294435;-0.000277319;0.999995,0,B_65x39_Caseless,32.893,0,0,0,0,0,0;0;0.001,4044.17;3900.52;1.2967,-0.1391;0.989408;-0.0415161,0.997572;0.0696383;-0.000952282,1.64624;-2.37598;3.70886,-281.912;-1.93603;-20.107,A3\data_f\Penetration\armour_plate_12mm.bisurf,7840,2
|
||||
hit:0,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984803;0.173649;-0.00284431,0.0029392;-0.00028929;0.999996,0,B_65x39_Caseless,32.893,0,0,0,0,0,0.001;0;0,4042.84;3900.02;1.34508,-0.315433;0.948498;-0.0292216,0.997554;0.0698984;-0.00106979,2.16724;-3.71533;3.75187,-741.758;-109.407;-22.8703,A3\data_f\Penetration\armour_plate_7mm.bisurf,7840,2
|
||||
hit:0,\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,BALLS,0.984803;0.173649;-0.00284431,0.0029392;-0.00028929;0.999996,0,B_65x39_Caseless,32.893,0,0,0,0,0,0.001;0;0,4042.84;3900.02;1.34508,-0.315433;0.948498;-0.0292216,0.997552;0.0699178;-0.00106975,1.90186;-3.77295;3.75505,-271.601;-59.8467;3.55743,A3\data_f\Penetration\armour_plate_30mm.bisurf,7840,2
|
||||
|
@ -167,14 +167,16 @@ namespace ace {
|
||||
batch.Begin();
|
||||
|
||||
for (gamehit_p & hit : _active_hits) {
|
||||
ace::vehicledamage::vehicle_p vehicle = ace::vehicledamage::controller::get().vehicles[hit->objectid];
|
||||
|
||||
ace::vector3<float> hit_from, hit_to, hit_surface;
|
||||
|
||||
hit_from = hit->impactposition;
|
||||
hit_to = hit_from + hit->impactvelocity;
|
||||
hit_from = hit->impactposition - hit->impactvelocity;
|
||||
hit_to = hit->impactposition;
|
||||
hit_surface = hit_from + hit->surface;
|
||||
|
||||
XMVECTORF32 from = { hit_from.x(), hit_from.y(), hit_from.z() };
|
||||
XMVECTORF32 to = { hit_to.x(), hit_to.y(), hit_to.z() };
|
||||
XMVECTORF32 from = { hit_from.x(), hit_from.z(), hit_from.y() };
|
||||
XMVECTORF32 to = { hit_to.x(), hit_to.z(), hit_to.y() };
|
||||
|
||||
VertexPositionColor v1(from, color);
|
||||
VertexPositionColor v2(to, color);
|
||||
@ -186,7 +188,7 @@ namespace ace {
|
||||
VertexPositionColor v1_surf(from, Colors::LightGreen);
|
||||
VertexPositionColor v2_surf(surface_direction, Colors::LightGreen);
|
||||
|
||||
batch.DrawLine(v1_surf, v2_surf);
|
||||
// batch.DrawLine(v1_surf, v2_surf);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user