Fixed issue with spalling happening on thin surfaces instead of thicker surfaces hit afterwards

This commit is contained in:
lambdatiger 2024-01-14 18:46:52 -06:00
parent 6ae6b55e65
commit fe1850a34a
3 changed files with 8 additions and 15 deletions

View File

@ -73,15 +73,15 @@ GVAR(lastSpallTime) = CBA_missionTime;
* Improve performance of finding otherside of object on shallow angle * Improve performance of finding otherside of object on shallow angle
* impacts. 120 degrees due to 90 degree offset with _lVelUnit into object. * impacts. 120 degrees due to 90 degree offset with _lVelUnit into object.
*/ */
private _spallPos = +_lPosASL; private _spallPos = _lPosASL vectorAdd _unitStep;
if (120 > acos ( _lVelUnit vectorDotProduct _sNorm)) then { if (120 > acos ( _lVelUnit vectorDotProduct _sNorm)) then {
_spallPos = _spallPos vectorAdd (_unitStep vectorMultiply 5); _spallPos = _spallPos vectorAdd (_unitStep vectorMultiply 5);
}; };
for "_i" from 1 to 20 do for "_i" from 2 to 20 do
{ {
private _nPos = _spallPos vectorAdd _unitStep; private _nPos = _spallPos vectorAdd _unitStep;
if (!lineIntersects [_spallPos, _nPos]) then { if (!lineIntersects [_spallPos, _nPos]) then {
_spallPos = _nPos vectorAdd _unitStep; _spallPos = _nPos vectorAdd (_unitStep vectorMultiply 2);
break break
}; };
_spallPos = _nPos; _spallPos = _nPos;

View File

@ -60,9 +60,10 @@ if (GVAR(spallEnabled) && {_shouldSpall}) then
private _ammo = typeOf _proj; private _ammo = typeOf _proj;
private _vUp = vectorUp _proj; private _vUp = vectorUp _proj;
[ [
GVAR(spall_eh), FUNC(doSpall),
[_proj, _hitObj, _posASL, _vel, _sNorm, _surfType, _ammo, _shotPrnt, _vUp] [_proj, _hitObj, _posASL, _vel, _sNorm, _surfType, _ammo, _shotPrnt, _vUp]
] call CBA_fnc_execNextFrame; ] call CBA_fnc_execNextFrame;
} }
]; ];
}; };
TRACE_2("exit",_shouldFrag,_shouldSpall);

View File

@ -3,8 +3,8 @@
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
// #define LOG_FRAG_INFO // #define LOG_FRAG_INFO
// #define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
// #define DEBUG_MODE_DRAW #define DEBUG_MODE_DRAW
// #define DISABLE_COMPILE_CACHE // #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS // #define ENABLE_PERFORMANCE_COUNTERS
@ -26,14 +26,6 @@
#define ACE_FRAG_HITPOINTS ["spine1","spine2","spine3","head","leftarm","leftarmroll","leftforearm","rightarm","rightarmroll","rightforearm","pelvis","leftupleg","leftuplegroll","leftlegroll","leftfoot","rightupleg","rightuplegroll","rightleg","rightlegroll","rightfoot"] #define ACE_FRAG_HITPOINTS ["spine1","spine2","spine3","head","leftarm","leftarmroll","leftforearm","rightarm","rightarmroll","rightforearm","pelvis","leftupleg","leftuplegroll","leftlegroll","leftfoot","rightupleg","rightuplegroll","rightleg","rightlegroll","rightfoot"]
#define ACE_FRAG_HITPOINTS_WEIGHTS #define ACE_FRAG_HITPOINTS_WEIGHTS
#ifdef DEBUG_MODE_FULL
#define __FADE_TIME 1
#define __FADE_START 0.5
#define __FADE_INTERVAL 0.1
#define __FADE_RATE __FADE_INTERVAL/__FADE_TIME/2
#define __FADE_INIT (__FADE_TIME+__FADE_START)/__FADE_TIME/2
#endif
#ifndef GLUE #ifndef GLUE
#define GLUE(g1,g2) g1##g2 #define GLUE(g1,g2) g1##g2
#endif #endif