Skip to content

Instantly share code, notes, and snippets.

@headswe
Created November 19, 2015 13:53
Show Gist options
  • Select an option

  • Save headswe/44393ba6ccf4d3fd7aa2 to your computer and use it in GitHub Desktop.

Select an option

Save headswe/44393ba6ccf4d3fd7aa2 to your computer and use it in GitHub Desktop.
Spawn building
params["_path","_pos","_dir"];
_createdObjects = [];
_objects = "isArray (_x >> 'position')" configClasses _path;
_multiplyMatrixFunc =
{
private ["_array1", "_array2", "_result"];
_array1 = _this select 0;
_array2 = _this select 1;
_result =
[
(((_array1 select 0) select 0) * (_array2 select 0)) + (((_array1 select 0) select 1) * (_array2 select 1)),
(((_array1 select 1) select 0) * (_array2 select 0)) + (((_array1 select 1) select 1) * (_array2 select 1))
];
_result
};
{
if(!isArray (_x >> "position")) then {systemChat "wat fuck"};
_objpos = getArray(_x >> "position");
_rotMatrix =
[
[cos _dir, sin _dir],
[-(sin _dir), cos _dir]
];
_objpos = [_rotMatrix, _objpos] call _multiplyMatrixFunc;
_objpos set [2,0];
_objpos = _pos vectoradd _objpos;
_odir = getNumber(_x >> "dir");
_classname = getText(_x >> "vehicle");
_veh = _classname createVehicle _objpos;
_veh setdir (_dir+_odir);
_veh setpos _objpos;
_createdObjects pushBack _veh;
} forEach _objects;
_createdObjects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment