Advertisement
NewbProgramming

Untitled

Mar 22nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.53 KB | None | 0 0
  1. static public int RayCastExplode(float x, float y, float z, float radius, out Vector3[] collisions, float intensity = 20.0f)
  2. {
  3.     collisions = new Vector3[0];
  4.  
  5.     if(intensity < 1.0 || intensity > 360.0 || (((360.0 / intensity) - Math.Round((360.0 / intensity))) * intensity) != 0.0)
  6.     {
  7.         return 0;
  8.     }
  9.            
  10.     List<Vector3> positions = new List<Vector3>();
  11.  
  12.     for(float lat = -180.0f; lat < 180.0f; lat += (intensity * 0.75f))
  13.     {
  14.         for(float lon = -90.0f; lon < 90.0f; lon += intensity)
  15.         {
  16.             float LAT = (float)(lat * Math.PI / 180.0f);
  17.             float LON = (float)(lon * Math.PI / 180.0f);
  18.             float cX = (float)(-radius * Math.Cos(LAT) * Math.Cos(LON));
  19.             float cY = (float)(radius * Math.Cos(LAT) * Math.Sin(LON));
  20.             float cZ = (float)(radius * Math.Sin(LAT));
  21.  
  22.             if(RayCastLine(x, y, z, x + cX, y + cY, z + cZ, out cX, out cY, out cZ) <= 0) continue;
  23.                    
  24.             positions.Add(new Vector3(cX, cY, cZ));
  25.         }
  26.     }
  27.  
  28.     collisions = positions.ToArray();
  29.     return positions.Count;
  30. }
  31.  
  32. /*
  33. [13:09:32] OnPlayerCommandText(Player(Id:0, Name:NewbProgramming), /rayexplode 50.0 20.0)
  34. [13:09:32] Your position: (2002.101, 1388.038, 9.257813)
  35. [13:09:32] 0: (2002.101, 1432.274, 9.257818)
  36. [13:09:32] 1: (2018.207, 1432.287, 9.257817)
  37. [13:09:32] 2: (2007.869, 1394.911, 9.257821)
  38. [13:09:32] 3: (2007.869, 1391.368, 9.257821)
  39. [13:09:32] 4: (2018.664, 1390.958, 9.25782)
  40. [13:09:32] 5: (2018.664, 1385.117, 9.25782)
  41. [13:09:32] 6: (2011.233, 1382.766, 9.257821)
  42. [13:09:32] 7: (2018.664, 1368.299, 9.257819)
  43. [13:09:32] 8: (2007.567, 1373.022, 9.25782)
  44. [13:09:32] 9: (2002.101, 1391.77, 8.257813)
  45. [13:09:32] 10: (2003.378, 1391.545, 8.257813)
  46. [13:09:32] 11: (2004.5, 1390.897, 8.257813)
  47. [13:09:32] 12: (2005.334, 1389.904, 8.257813)
  48. [13:09:32] 13: (2005.777, 1388.686, 8.257813)
  49. [13:09:32] 14: (2005.777, 1387.39, 8.257813)
  50. [13:09:32] 15: (2005.333, 1386.172, 8.257813)
  51. [13:09:32] 16: (2004.5, 1385.179, 8.257813)
  52. [13:09:32] 17: (2003.378, 1384.531, 8.257813)
  53. [13:09:32] 18: (2002.101, 1389.77, 8.257813)
  54. [13:09:32] 19: (2002.694, 1389.665, 8.257813)
  55. [13:09:32] 20: (2003.215, 1389.365, 8.257813)
  56. [13:09:32] 21: (2003.601, 1388.904, 8.257813)
  57. [13:09:32] 22: (2003.807, 1388.339, 8.257813)
  58. [13:09:32] 23: (2003.807, 1387.737, 8.257813)
  59. [13:09:32] 24: (2003.601, 1387.172, 8.257813)
  60. [13:09:32] 25: (2003.215, 1386.711, 8.257813)
  61. [13:09:32] 26: (2002.694, 1386.41, 8.257813)
  62. [13:09:32] 27: (2002.101, 1389.038, 8.257813)
  63. [13:09:32] 28: (2002.443, 1388.978, 8.257813)
  64. [13:09:32] 29: (2002.744, 1388.804, 8.257813)
  65. [13:09:32] 30: (2002.967, 1388.538, 8.257813)
  66. [13:09:32] 31: (2003.086, 1388.211, 8.257813)
  67. [13:09:32] 32: (2003.086, 1387.864, 8.257813)
  68. [13:09:32] 33: (2002.967, 1387.538, 8.257813)
  69. [13:09:32] 34: (2002.744, 1387.272, 8.257813)
  70. [13:09:32] 35: (2002.443, 1387.098, 8.257813)
  71. [13:09:32] 36: (2002.101, 1388.615, 8.257813)
  72. [13:09:32] 37: (2002.299, 1388.58, 8.257813)
  73. [13:09:32] 38: (2002.473, 1388.48, 8.257813)
  74. [13:09:32] 39: (2002.601, 1388.327, 8.257813)
  75. [13:09:32] 40: (2002.67, 1388.138, 8.257813)
  76. [13:09:32] 41: (2002.67, 1387.938, 8.257813)
  77. [13:09:32] 42: (2002.601, 1387.749, 8.257813)
  78. [13:09:32] 43: (2002.473, 1387.596, 8.257813)
  79. [13:09:32] 44: (2002.299, 1387.495, 8.257813)
  80. [13:09:32] 45: (2002.101, 1388.306, 8.257813)
  81. [13:09:32] 46: (2002.193, 1388.29, 8.257813)
  82. [13:09:32] 47: (2002.274, 1388.243, 8.257813)
  83. [13:09:32] 48: (2002.333, 1388.172, 8.257813)
  84. [13:09:32] 49: (2002.365, 1388.084, 8.257813)
  85. [13:09:32] 50: (2002.365, 1387.991, 8.257813)
  86. [13:09:32] 51: (2002.333, 1387.904, 8.257813)
  87. [13:09:32] 52: (2002.274, 1387.833, 8.257813)
  88. [13:09:32] 53: (2002.193, 1387.786, 8.257813)
  89. [13:09:32] 54: (2002.101, 1388.038, 8.257813)
  90. [13:09:32] 55: (2002.101, 1388.038, 8.257813)
  91. [13:09:32] 56: (2002.101, 1388.038, 8.257813)
  92. [13:09:32] 57: (2002.101, 1388.038, 8.257813)
  93. [13:09:32] 58: (2002.101, 1388.038, 8.257813)
  94. [13:09:32] 59: (2002.101, 1388.038, 8.257813)
  95. [13:09:32] 60: (2002.101, 1388.038, 8.257813)
  96. [13:09:32] 61: (2002.101, 1388.038, 8.257813)
  97. [13:09:32] 62: (2002.101, 1388.038, 8.257813)
  98. [13:09:32] 63: (2002.101, 1387.77, 8.257813)
  99. [13:09:32] 64: (2002.01, 1387.786, 8.257813)
  100. [13:09:32] 65: (2001.929, 1387.833, 8.257813)
  101. [13:09:32] 66: (2001.869, 1387.904, 8.257813)
  102. [13:09:32] 67: (2001.838, 1387.991, 8.257813)
  103. [13:09:32] 68: (2001.838, 1388.084, 8.257813)
  104. [13:09:32] 69: (2001.869, 1388.172, 8.257813)
  105. [13:09:32] 70: (2001.929, 1388.243, 8.257813)
  106. [13:09:32] 71: (2002.01, 1388.29, 8.257813)
  107. [13:09:32] 72: (2002.101, 1387.46, 8.257813)
  108. [13:09:32] 73: (2001.904, 1387.495, 8.257813)
  109. [13:09:32] 74: (2001.73, 1387.596, 8.257813)
  110. [13:09:32] 75: (2001.601, 1387.749, 8.257813)
  111. [13:09:32] 76: (2001.533, 1387.938, 8.257813)
  112. [13:09:32] 77: (2001.533, 1388.138, 8.257813)
  113. [13:09:32] 78: (2001.601, 1388.327, 8.257813)
  114. [13:09:32] 79: (2001.73, 1388.48, 8.257813)
  115. [13:09:32] 80: (2001.904, 1388.58, 8.257813)
  116. [13:09:32] 81: (2002.101, 1387.038, 8.257813)
  117. [13:09:32] 82: (2001.759, 1387.098, 8.257813)
  118. [13:09:32] 83: (2001.459, 1387.272, 8.257813)
  119. [13:09:32] 84: (2001.235, 1387.538, 8.257813)
  120. [13:09:32] 85: (2001.117, 1387.864, 8.257813)
  121. [13:09:32] 86: (2001.117, 1388.211, 8.257813)
  122. [13:09:32] 87: (2001.235, 1388.538, 8.257813)
  123. [13:09:32] 88: (2001.459, 1388.804, 8.257813)
  124. [13:09:32] 89: (2001.759, 1388.978, 8.257813)
  125. [13:09:32] 90: (2002.101, 1386.306, 8.257813)
  126. [13:09:32] 91: (2001.509, 1386.41, 8.257813)
  127. [13:09:32] 92: (2000.988, 1386.711, 8.257813)
  128. [13:09:32] 93: (2000.601, 1387.172, 8.257813)
  129. [13:09:32] 94: (2000.396, 1387.737, 8.257813)
  130. [13:09:32] 95: (2000.396, 1388.339, 8.257813)
  131. [13:09:32] 96: (2000.601, 1388.904, 8.257813)
  132. [13:09:32] 97: (2000.988, 1389.365, 8.257813)
  133. [13:09:32] 98: (2001.509, 1389.665, 8.257813)
  134. [13:09:32] 99: (2002.101, 1384.306, 8.257813)
  135. [13:09:32] 100: (2000.825, 1384.531, 8.257813)
  136. [13:09:32] 101: (1999.703, 1385.179, 8.257813)
  137. [13:09:32] 102: (1998.869, 1386.172, 8.257813)
  138. [13:09:32] 103: (1998.426, 1387.39, 8.257813)
  139. [13:09:32] 104: (1998.426, 1388.686, 8.257813)
  140. [13:09:32] 105: (1998.869, 1389.904, 8.257813)
  141. [13:09:32] 106: (1999.703, 1390.897, 8.257813)
  142. [13:09:32] 107: (2000.825, 1391.545, 8.257813)
  143. [13:09:32] 108: (2002.101, 1366.274, 9.257818)
  144. [13:09:32] 109: (1999.491, 1380.865, 9.25782)
  145. [13:09:32] 110: (1997.329, 1382.35, 9.257821)
  146. [13:09:32] 111: (1976.101, 1373.027, 9.257816)
  147. [13:09:32] 112: (1969.12, 1382.222, 9.257815)
  148. [13:09:32] 113: (1992.703, 1389.695, 9.25782)
  149. [13:09:32] 114: (1994.545, 1392.4, 9.25782)
  150. [13:09:32] 115: (1973.402, 1422.24, 9.257813)
  151. [13:09:32] 116: (1996.933, 1402.239, 9.257819)
  152. [13:09:32] 117: (2002.101, 1352.608, 18.7513)
  153. [13:09:32] 118: (1999.497, 1380.881, 11.29856)
  154. [13:09:32] 119: (1997.329, 1382.351, 11.24708)
  155. [13:09:32] 120: (1969.145, 1382.227, 18.22464)
  156. [13:09:32] 121: (1972.031, 1423.874, 21.7927)
  157. [13:09:32] 122: (1996.924, 1402.262, 13.31371)
  158. [13:09:32] 123: (1999.491, 1380.865, 13.66456)
  159. [13:09:32] 124: (1997.329, 1382.35, 13.54474)
  160. [13:09:32] 125: (1996.924, 1402.262, 17.9971)
  161. [13:09:32] 126: (1999.491, 1380.866, 16.89015)
  162. [13:09:32] 127: (1997.329, 1382.35, 16.68297)
  163. [13:09:32] 128: (1996.924, 1402.262, 24.3944)
  164. [13:09:32] 129: (1999.491, 1380.865, 22.47786)
  165. [13:09:32] 130: (1997.329, 1382.35, 22.11855)
  166. [13:09:32] 131: (2011.234, 1382.765, 19.80331)
  167. [13:09:32] 132: (2011.234, 1382.765, 15.34611)
  168. [13:09:32] 133: (2022.812, 1384.386, 14.89266)
  169. [13:09:32] 134: (2011.234, 1382.765, 12.08349)
  170. [13:09:32] 135: (2020.97, 1365.551, 17.12321)
  171. [13:09:32] 136: (2017.595, 1345.47, 21.39591)
  172. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement