Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GetObjectBox = {
- //Use: _Box = [Object,Height_Int] call GetObjectBox;
- //Variables to be passed: [Object,Height];
- _obj=_this select 0;
- _height = _this select 1;
- //Calculate Object Size
- //_front = BoundingBox ......
- //_back = BoundingBox .....
- //_left = BoundingBox .....
- //_right = BoundingBox .....
- //_top = BoundingBox .....
- //_bottom = BoundingBox .....
- //Calculate Front/Back sin
- // _FBSin = sin dir _obj .....
- //Calculate Front Location
- // _FLocation = _FBSin * _front ....
- //Calculate Back Location
- // _BLocation = _FBSin * _back ....
- //Calculate Left/Right sin
- // _LRSin = sin dir _obj .....
- //Calculate Left Location
- // _LLocation = _LRSin * _left ....
- //Calculate Right Location
- // _RLocation = _LRSin * _right ....
- //Calculate Top location
- //_topLocation = ((getPosWorld _obj) select 2) + _top;
- //Calculate Bottom Location
- //_bottomLocation = ((getPosWorld _obj) select 2) + _bottom;
- //Add Height to Top Location
- //_topLocation = _topLocation + _height;
- _return = [_FLocation,_BLocation,_RLocation,_LLocation,_topLocation,_bottomLocation];
- _return
- };
- FindObjInBox = {
- //Use: [_FLocation,_BLocation,_RLocation,_LLocation,_topLocation,_bottomLocation,Object] call FindObjInBox;
- _FLocation = _this select 0;
- _BLocation = _this select 1;
- _RLocation = _this select 2;
- _LLocation = _this select 3;
- _topLocation = _this select 4;
- _bottomLocation = _this select 5;
- _Object = _this select 6;
- //_ObjectSize = BoundingBoxReal _Object .... //Get object size
- //Get List of objects within BoundingBoxSize;
- /*
- _size = BoundingBoxReal _obj ... //Calculate size of box here
- _goodObjects = [];
- //Below finds objects nearby.
- {
- if (_x distance _Object < _size) then {
- _goodObjects = _goodObjects + [_x];
- };
- } forEach nearObjects _Object;
- */
- //Check if nearby objects are within Box
- /*
- {
- _xDist = _x distance _Object;
- if (_xDist distance _FLocation < _ObjectSize) then {
- _checkArray = [true];
- } else {
- _checkArray = [false];
- };
- if (_xDist distance _RLocation < _ObjectSize) then {
- _checkArray = _checkArray + [true];
- } else {
- _checkArray = _checkArray + [false];
- };
- if (_xDist distance _LLocation < _ObjectSize) then {
- _checkArray = _checkArray + [true];
- } else {
- _checkArray = _checkArray + [false];
- };
- if (_xDist distance _RLocation < _ObjectSize) then {
- _checkArray = _checkArray + [true];
- } else {
- _checkArray = _checkArray + [false];
- };
- if (_xDist distance _topLocation < _ObjectSize) then {
- _checkArray = _checkArray + [true];
- } else {
- _checkArray = _checkArray + [false];
- };
- if (_xDist distance _bottomLocation < _ObjectSize) then {
- _checkArray = _checkArray + [true];
- } else {
- _checkArray = _checkArray + [false];
- };
- if (false in _checkArray) then {
- _return = _return + [_x];
- };
- } forEach _goodObjects;
- _return
- */
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement