mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Minor wind deflection optimization (#4762)
This commit is contained in:
parent
d8fec7fbe3
commit
988c5b0a25
@ -29,16 +29,16 @@
|
|||||||
_x params ["_bullet", "_airFriction"];
|
_x params ["_bullet", "_airFriction"];
|
||||||
|
|
||||||
private _bulletVelocity = velocity _bullet;
|
private _bulletVelocity = velocity _bullet;
|
||||||
private _bulletSpeed = vectorMagnitude _bulletVelocity;
|
private _bulletSpeedSqr = vectorMagnitudeSqr _bulletVelocity;
|
||||||
|
|
||||||
if ((!alive _bullet) || {(_bullet isKindOf "BulletBase") && {_bulletSpeed < 100}}) then {
|
if ((!alive _bullet) || {(_bullet isKindOf "BulletBase") && {_bulletSpeedSqr < 10000}}) then {
|
||||||
GVAR(trackedBullets) deleteAt (GVAR(trackedBullets) find _x);
|
GVAR(trackedBullets) deleteAt (GVAR(trackedBullets) find _x);
|
||||||
} else {
|
} else {
|
||||||
if (_isWind) then {
|
if (_isWind) then {
|
||||||
private _trueVelocity = _bulletVelocity vectorDiff ACE_wind;
|
private _trueVelocity = _bulletVelocity vectorDiff ACE_wind;
|
||||||
private _trueSpeed = vectorMagnitude _trueVelocity;
|
private _trueSpeed = vectorMagnitude _trueVelocity;
|
||||||
|
|
||||||
private _dragRef = _deltaT * _airFriction * _bulletSpeed * _bulletSpeed;
|
private _dragRef = _deltaT * _airFriction * _bulletSpeedSqr;
|
||||||
private _accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef);
|
private _accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef);
|
||||||
_bulletVelocity = _bulletVelocity vectorDiff _accelRef;
|
_bulletVelocity = _bulletVelocity vectorDiff _accelRef;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user