Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. GetObjectBox = {
  2. //Use: _Box = [Object,Height_Int] call GetObjectBox;
  3. //Variables to be passed: [Object,Height];
  4. _obj=_this select 0;
  5. _height = _this select 1;
  6. //Calculate Object Size
  7. //_front = BoundingBox ......
  8. //_back = BoundingBox .....
  9. //_left = BoundingBox .....
  10. //_right = BoundingBox .....
  11. //_top = BoundingBox .....
  12. //_bottom = BoundingBox .....
  13. //Calculate Front/Back sin
  14. // _FBSin = sin dir _obj .....
  15. //Calculate Front Location
  16. // _FLocation = _FBSin * _front ....
  17. //Calculate Back Location
  18. // _BLocation = _FBSin * _back ....
  19. //Calculate Left/Right sin
  20. // _LRSin = sin dir _obj .....
  21. //Calculate Left Location
  22. // _LLocation = _LRSin * _left ....
  23. //Calculate Right Location
  24. // _RLocation = _LRSin * _right ....
  25. //Calculate Top location
  26. //_topLocation = ((getPosWorld _obj) select 2) + _top;
  27. //Calculate Bottom Location
  28. //_bottomLocation = ((getPosWorld _obj) select 2) + _bottom;
  29. //Add Height to Top Location
  30. //_topLocation = _topLocation + _height;
  31. _return = [_FLocation,_BLocation,_RLocation,_LLocation,_topLocation,_bottomLocation];
  32. _return
  33. };
  34.  
  35. FindObjInBox = {
  36. //Use: [_FLocation,_BLocation,_RLocation,_LLocation,_topLocation,_bottomLocation,Object] call FindObjInBox;
  37. _FLocation = _this select 0;
  38. _BLocation = _this select 1;
  39. _RLocation = _this select 2;
  40. _LLocation = _this select 3;
  41. _topLocation = _this select 4;
  42. _bottomLocation = _this select 5;
  43. _Object = _this select 6;
  44. //_ObjectSize = BoundingBoxReal _Object .... //Get object size
  45. //Get List of objects within BoundingBoxSize;
  46. /*
  47. _size = BoundingBoxReal _obj ... //Calculate size of box here
  48. _goodObjects = [];
  49. //Below finds objects nearby.
  50. {
  51. if (_x distance _Object < _size) then {
  52. _goodObjects = _goodObjects + [_x];
  53. };
  54. } forEach nearObjects _Object;
  55. */
  56.  
  57. //Check if nearby objects are within Box
  58. /*
  59. {
  60. _xDist = _x distance _Object;
  61. if (_xDist distance _FLocation < _ObjectSize) then {
  62. _checkArray = [true];
  63. } else {
  64. _checkArray = [false];
  65. };
  66.  
  67. if (_xDist distance _RLocation < _ObjectSize) then {
  68. _checkArray = _checkArray + [true];
  69. } else {
  70. _checkArray = _checkArray + [false];
  71. };
  72.  
  73. if (_xDist distance _LLocation < _ObjectSize) then {
  74. _checkArray = _checkArray + [true];
  75. } else {
  76. _checkArray = _checkArray + [false];
  77. };
  78.  
  79. if (_xDist distance _RLocation < _ObjectSize) then {
  80. _checkArray = _checkArray + [true];
  81. } else {
  82. _checkArray = _checkArray + [false];
  83. };
  84.  
  85. if (_xDist distance _topLocation < _ObjectSize) then {
  86. _checkArray = _checkArray + [true];
  87. } else {
  88. _checkArray = _checkArray + [false];
  89. };
  90.  
  91. if (_xDist distance _bottomLocation < _ObjectSize) then {
  92. _checkArray = _checkArray + [true];
  93. } else {
  94. _checkArray = _checkArray + [false];
  95. };
  96. if (false in _checkArray) then {
  97. _return = _return + [_x];
  98. };
  99. } forEach _goodObjects;
  100. _return
  101. */
  102. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement