mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
More vector math replacements
This commit is contained in:
parent
0d6d96e76c
commit
416a914253
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_color", "_data", "_index", "_obj", "_objTVel", "_objVel", "_origin", "_positions"];
|
||||
private ["_color", "_data", "_index", "_obj", "_objSpd", "_origin", "_positions"];
|
||||
|
||||
if (GVAR(autoTrace)) then {
|
||||
[] call FUNC(startTracing);
|
||||
@ -15,10 +15,9 @@ if((count _this) > 2) then {
|
||||
_color = _this select 2;
|
||||
};
|
||||
_positions = [];
|
||||
_objVel = velocity _obj;
|
||||
_objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2);
|
||||
_positions set[(count _positions), [(getPos _obj), _objTVel]];
|
||||
_data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color];
|
||||
_objSpd = vectorMagnitude (velocity _obj);
|
||||
_positions set[(count _positions), [(getPos _obj), _objSpd]];
|
||||
_data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color];
|
||||
|
||||
GVAR(traces) set[_index, _data];
|
||||
[DFUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler;
|
||||
|
@ -65,16 +65,8 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
|
||||
_pos = _hpData select 3;
|
||||
_spallPos = nil;
|
||||
for "_i" from 0 to 100 do {
|
||||
_pos1 = [
|
||||
(_pos select 0) + (((_unitDir select 0)*0.01)*_i),
|
||||
(_pos select 1) + (((_unitDir select 1)*0.01)*_i),
|
||||
(_pos select 2) + (((_unitDir select 2)*0.01)*_i)
|
||||
];
|
||||
_pos2 = [
|
||||
(_pos select 0) + (((_unitDir select 0)*0.01)*(_i+1)),
|
||||
(_pos select 1) + (((_unitDir select 1)*0.01)*(_i+1)),
|
||||
(_pos select 2) + (((_unitDir select 2)*0.01)*(_i+1))
|
||||
];
|
||||
_pos1 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * _i));
|
||||
_pos2 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * (_i + 1)));
|
||||
// _blah = [_object, "FIRE"] intersect [_object worldToModel (ASLtoATL _pos1), _object worldToModel (ASLtoATL _pos2)];
|
||||
// diag_log text format["b: %1", _blah];
|
||||
|
||||
|
@ -7,10 +7,7 @@ private ["_color", "_index", "_lastPos", "_lastSpd", "_max", "_positions", "_sta
|
||||
_color = _x select 5;
|
||||
_index = 0;
|
||||
_max = count _positions;
|
||||
_startSpeed = (_positions select 0) select 1;
|
||||
if(_startSpeed <= 0) then {
|
||||
_startSpeed = 0.01;
|
||||
};
|
||||
_startSpeed = 0.01 max ((_positions select 0) select 1);
|
||||
_lastSpd = [];
|
||||
_lastPos = [];
|
||||
while {_index < _max} do {
|
||||
|
@ -159,11 +159,7 @@ if(_isArmed && (count _objects) > 0) then {
|
||||
_vec set[2, (_vec select 2)-(_vecVar/2)+(random _vecVar)];
|
||||
|
||||
_fp = (_fragPower-(random (_fragPowerRandom)));
|
||||
_vel = [
|
||||
(_vec select 0)*_fp,
|
||||
(_vec select 1)*_fp,
|
||||
(_vec select 2)*_fp
|
||||
];
|
||||
_vel = _vec vectorMultiply _fp;
|
||||
|
||||
_fragType = round (random ((count _fragTypes)-1));
|
||||
_fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
||||
@ -198,14 +194,10 @@ if(_isArmed && (count _objects) > 0) then {
|
||||
_sectorOffset = 360 * (_i - 1) / (_randomCount max 1);
|
||||
_randomDir = random(_sectorSize);
|
||||
_vec = [cos(_sectorOffset + _randomDir), sin(_sectorOffset + _randomDir), sin(30 - (random 45))];
|
||||
|
||||
|
||||
_fp = (_fragPower-(random (_fragPowerRandom)));
|
||||
|
||||
_vel = [
|
||||
(_vec select 0)*_fp,
|
||||
(_vec select 1)*_fp,
|
||||
(_vec select 2)*_fp
|
||||
];
|
||||
|
||||
_vel = _vec vectorMultiply _fp;
|
||||
|
||||
_fragType = round (random ((count _fragTypes)-1));
|
||||
_fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
||||
|
Loading…
Reference in New Issue
Block a user