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