using System.Collections; using System.Collections.Generic; using UnityEngine; public class ZodiacConstellations : MonoBehaviour { [Header("Сузір'я")] public bool aries = true; public bool taurus = true; public bool gemini = true; public bool cancer = true; public bool leo = true; public bool virgo = true; public bool libra = true; public bool scorpio = true; public bool ophiuchus = true; public bool sagittarius = true; public bool capricorn = true; public bool aquarius = true; public bool pisces = true; [Header("Налаштування")] public float starSize = 140f; public float lineWidth = 12f; public float distance = 65000f; public float constellationScale = 1f; [Header("Матеріал")] [SerializeField] private GameObject starPrefab; [Header("Кольори")] public Color lineColor = new Color(0.7f, 0.85f, 1f, 1f); [SerializeField] private Material lineMaterial; private Material _lineMaterial; [SerializeField] private GameObject constellationParticlesPrefab; private struct ConstellationData { public string name; public float lon; public Vector3[] stars; public Vector2Int[] lines; public float[] sizes; public Color[] colors; public Vector3 rotation; public ConstellationData( string name, float lon, Vector3[] stars, Vector2Int[] lines, float[] sizes, Color[] colors, Vector3 rotation) { this.name = name; this.lon = lon; this.stars = stars; this.lines = lines; this.sizes = sizes; this.colors = colors; this.rotation = rotation; } } void Start() { _lineMaterial = lineMaterial; if (aries) { CreateConstellation(BuildAries(), 23.5f); } if (taurus) { CreateConstellation(BuildTaurus(), 23.5f); } if (gemini) { CreateConstellation(BuildGemini(), 23.5f); } if (cancer) { CreateConstellation(BuildCancer(), 23.5f); } if (leo) { CreateConstellation(BuildLeo(), 23.5f); } if (virgo) { CreateConstellation(BuildVirgo(), 23.5f); } if (libra) { CreateConstellation(BuildLibra(), 23.5f); } if (scorpio) { CreateConstellation(BuildScorpius(), 23.5f); } if (ophiuchus) { CreateConstellation(BuildOphiuchus(), 23.5f); } if (sagittarius) { CreateConstellation(BuildSagittarius(), 23.5f); } if (capricorn) { CreateConstellation(BuildCapricorn(), 23.5f); } if (aquarius) { CreateConstellation(BuildAquarius(), 23.5f); } if (pisces) { CreateConstellation(BuildPisces(), 23.5f); } } private ConstellationData BuildAries() { Vector3[] stars = { new Vector3(-216, -185, 0), new Vector3(-117, -45, 0), new Vector3(101, 64, 0), new Vector3(533, 200, 0), new Vector3(930, -45, 0), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(3, 4), }; float[] sizes = { 0.85f, 0.9f, 1.0f, 2.4f, 1.8f }; Color[] colors = { new Color(0.7f, 0.7f, 0.7f, 0.55f), new Color(0.75f, 0.75f, 0.75f, 0.6f), new Color(0.8f, 0.8f, 0.8f, 0.65f), new Color(1f, 0.9f, 0.7f, 0.9f), new Color(1f, 0.95f, 0.6f, 1f) }; return new ConstellationData( "Aries", 0, stars, lines, sizes, colors, new Vector3(0f, 0f, 0f) ); } private ConstellationData BuildTaurus() { Vector3[] stars = { new Vector3(1637, 897, 0), new Vector3(1048, 459, 0), new Vector3(647, 130, 0), new Vector3(609, 302, 0), new Vector3( 728, 388,0), new Vector3( 639, 473,0), new Vector3(809, 891, 0), new Vector3( 1350, 1229,0), new Vector3(118, -77, 0), new Vector3(-141, 64, 407), new Vector3(-1041, -560, 126), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(3, 4), new Vector2Int(4, 5), new Vector2Int(5, 6), new Vector2Int(6, 7), new Vector2Int(2, 8), new Vector2Int(8, 9), new Vector2Int(9, 10) }; float[] sizes = { 1f, 0.9f, 1.2f, 0.8f, 0.9f, 0.7f, 1f, 2.2f, 2.6f, 0.85f, 1.2f }; Color[] colors = { new Color(0.8f, 0.8f, 0.8f, 0.65f), new Color(0.8f, 0.8f, 0.8f, 0.6f), new Color(0.75f, 0.75f, 0.75f, 0.6f), new Color(0.7f, 0.7f, 0.7f, 0.55f), new Color(0.8f, 0.8f, 0.8f, 0.65f), new Color(0.75f, 0.75f, 0.75f, 0.6f), new Color(0.7f, 0.7f, 0.7f, 0.6f), new Color(1f, 0.9f, 0.65f, 0.95f), new Color(1f, 0.95f, 0.6f, 1f), new Color(0.7f, 0.7f, 0.7f, 0.55f), new Color(0.85f, 0.85f, 0.85f, 0.7f), }; return new ConstellationData( "Taurus", 30f, stars, lines, sizes, colors, new Vector3(0f, 0f, 0f) ); } private ConstellationData BuildGemini() { Vector3[] stars = { new Vector3( -928, 668, 0), new Vector3( -581, 520, 0), new Vector3( -210, 436, 0), new Vector3( 368, 659, 0), new Vector3( 699, 562, 0), new Vector3( 714, 175, 0), new Vector3( 473, -164, 0), new Vector3(7, -244, 0), new Vector3(-838, -207, 0), new Vector3(-774, -612, 0), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(3, 4), new Vector2Int(4, 5), new Vector2Int(5, 6), new Vector2Int(6, 7), new Vector2Int(7, 8), new Vector2Int(8, 9), new Vector2Int(1, 8), }; float[] sizes = { 0.95f, 1.0f, 0.95f, 2.3f, 1.0f, 2.1f, 0.95f, 1.0f, 2.6f, 0.9f, }; Color[] colors = { new Color(0.85f, 0.85f, 0.85f, 0.65f), new Color(0.85f, 0.85f, 0.85f, 0.65f), new Color(0.8f, 0.8f, 0.8f, 0.6f), new Color(1f, 0.95f, 0.6f, 1f), new Color(0.85f, 0.85f, 0.85f, 0.65f), new Color(1f, 0.9f, 0.65f, 0.95f), new Color(0.8f, 0.8f, 0.8f, 0.6f), new Color(0.8f, 0.8f, 0.8f, 0.6f), new Color(1f, 0.95f, 0.6f, 1f), new Color(0.75f, 0.75f, 0.75f, 0.55f), }; return new ConstellationData( "Gemini", 60f, stars, lines, sizes, colors, new Vector3(30.271f, -169.031f, 5.183f) ); } private ConstellationData BuildCancer() { Vector3[] stars = { new Vector3( -939, 318, 0), new Vector3( 206, 721, 0), new Vector3( 453, 1103, 0), new Vector3(1131, 1469, 0), new Vector3( 125, -140, 0), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(1, 4), }; float[] sizes = { 2.6f, 2.3f, 0.9f, 2.4f, 0.85f }; Color[] colors = { new Color(1f, 0.95f, 0.6f, 1f), new Color(1f, 0.9f, 0.65f, 0.95f), new Color(0.75f, 0.75f, 0.75f, 0.6f), new Color(1f, 0.95f, 0.6f, 1f), new Color(0.7f, 0.7f, 0.7f, 0.55f), }; return new ConstellationData( "Cancer", 90f, stars, lines, sizes, colors, new Vector3(23.972f, 180f, 21.876f) ); } private ConstellationData BuildLeo() { Vector3[] stars = { new Vector3( 621, 858, 0), new Vector3( 906, 455, 0), new Vector3( 876, 47, 0), new Vector3( 482, 50, 0), new Vector3(815, -645, 0), new Vector3( 624, -1121, 0), new Vector3(524, -755, 0), new Vector3(-362, 91, 286), new Vector3(203, 243, 0), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(3, 4), new Vector2Int(4, 5), new Vector2Int(5, 6), new Vector2Int(6, 7), new Vector2Int(7, 8), new Vector2Int(8, 3), }; float[] sizes = { 0.75f, 0.75f, 0.75f, 1.4f, 1.0f, 2.6f, 0.75f, 2.8f, 0.75f, }; Color[] colors = { new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.9f, 0.9f, 0.9f, 0.75f), new Color(0.85f,0.85f,0.85f,0.65f), new Color(1f, 0.9f, 0.65f, 1f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(1f, 0.95f,0.6f, 1f), new Color(0.75f,0.75f,0.75f,0.55f), }; return new ConstellationData( "Leo", 120f, stars, lines, sizes, colors, new Vector3(28.46f, 0f, 61.87f) ); } private ConstellationData BuildVirgo() { Vector3[] stars = { new Vector3(35, 3186,1949), new Vector3(-177, 2949,1949), new Vector3( 49, 2664, 1949), new Vector3( 687, 2463, 1949), new Vector3( 1109, 2692, 1736), new Vector3(633, 1735, 1736), new Vector3(1060, 1495, 1736), new Vector3(1286, 1110, 1736), new Vector3(-746, 1735, 1736), new Vector3(-351, 2049, 1736), new Vector3(-681, 1357, 1736), new Vector3(-165, 1308, 1736), new Vector3(-52, 919, 1736), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(3, 4), new Vector2Int(3, 5), new Vector2Int(5, 6), new Vector2Int(6, 7), new Vector2Int(5, 8), new Vector2Int(8, 9), new Vector2Int(9, 2), new Vector2Int(8, 10), new Vector2Int(10, 11), new Vector2Int(11, 12), }; float[] sizes = { 0.75f, 0.75f, 0.75f, 1.4f, 1.0f, 2.6f, 0.75f, 2.8f, 0.75f, 0.75f, 1.3f, 0.75f, 0.75f }; Color[] colors = { new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.9f, 0.9f, 0.9f, 0.75f), new Color(0.85f,0.85f,0.85f,0.65f), new Color(1f, 0.9f, 0.65f, 1f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(1f, 0.95f,0.6f, 1f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f, 0.75f,0.75f, 0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), }; return new ConstellationData( "Virgo", 150f, stars, lines, sizes, colors, new Vector3(-2.996f, -169.314f, 79.088f) ); } private ConstellationData BuildLibra() { Vector3[] stars = { new Vector3(812, -439, 0), new Vector3( 286, -334, 0), new Vector3( 71, -115, 0), new Vector3( 48, 764, 0), new Vector3( -1109, 300, 0), new Vector3(-645, -561, 0), new Vector3(-15, -924, 0), new Vector3(-180, -1209, 0), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(3, 5), new Vector2Int(3, 4), new Vector2Int(4, 5), new Vector2Int(5, 6), new Vector2Int(6, 7), }; float[] sizes = { 0.95f, 1.0f, 0.95f, 2.3f, 1.0f, 1f, 0.95f, 2.1f, }; Color[] colors = { new Color(0.85f, 0.85f, 0.85f, 0.65f), new Color(0.85f, 0.85f, 0.85f, 0.65f), new Color(0.8f, 0.8f, 0.8f, 0.6f), new Color(1f, 0.95f, 0.6f, 1f), new Color(0.85f, 0.85f, 0.85f, 0.65f), new Color(0.8f, 0.8f, 0.8f, 0.6f), new Color(0.8f, 0.8f, 0.8f, 0.6f), new Color(1f, 0.9f, 0.65f, 0.95f), }; return new ConstellationData( "Libra", 180f, stars, lines, sizes, colors, new Vector3(0f, 90f, 24.22f) ); } private ConstellationData BuildScorpius() { Vector3[] stars = { new Vector3(-293, -1064, 4579), new Vector3( -215, -1053, 4579), new Vector3( -157, -1265, 4579), new Vector3(-381, -1505, 4579), new Vector3( -609, -1472, 4579), new Vector3(-808, -1409, 4579), new Vector3(-789, -1182, 4579), new Vector3(-809, -1064, 4579), new Vector3(-1026, -835, 4579), new Vector3(-1197, -716, 4579), new Vector3(-1343, -603, 4579), new Vector3(-1668, -409, 4579), new Vector3(-1478, -287, 4579), new Vector3(-1716, -623,4579), new Vector3(-1642, -804, 4579), }; Vector2Int[] lines = { new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(2, 3), new Vector2Int(3, 4), new Vector2Int(4, 5), new Vector2Int(5, 6), new Vector2Int(6, 7), new Vector2Int(7, 8), new Vector2Int(8, 9), new Vector2Int(9,10), new Vector2Int(10,11), new Vector2Int(11,12), new Vector2Int(13,14), new Vector2Int(11,12), new Vector2Int(11,13), }; float[] sizes = { 2.4f, 0.9f, 2.2f, 0.9f, 0.85f, 0.85f, 0.85f, 2.3f, 0.9f, 2.4f, 0.9f, 2.6f, 2.2f, 0.95f, 0.85f }; Color[] colors = { new Color(1f,0.9f,0.6f,1f), new Color(0.8f,0.8f,0.8f,0.6f), new Color(1f,0.9f,0.65f,1f), new Color(0.8f,0.8f,0.8f,0.6f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(0.75f,0.75f,0.75f,0.55f), new Color(1f,0.9f,0.65f,1f), new Color(0.8f,0.8f,0.8f,0.6f), new Color(1f,0.95f,0.6f,1f), new Color(0.8f,0.8f,0.8f,0.6f), new Color(1f,0.9f,0.6f,1f), new Color(1f,0.9f,0.6f,1f), new Color(0.85f,0.85f,0.85f,0.65f), new Color(0.75f,0.75f,0.75f,0.55f), }; return new ConstellationData( "Scorpius", 210f, stars, lines, sizes, colors, new Vector3(-14.263f, 62.1f, 0f) ); } private ConstellationData BuildOphiuchus() { Vector3[] stars = { new Vector3(1130, -3509, 0), new Vector3(841, -3488, 0), new Vector3( 683, -3382, 0), new Vector3( 542, -2611, 0), new Vector3( -121, -3199, 0), new Vector3( -433, -3584, 0), new Vector3(-539, -3868, 0), new Vector3(-697, -3782, 0), new Vector3( -264, -4335, 0), new Vector3( 326, -4659, 0), }; Vector2Int[] lines = { new Vector2Int(0,1), new Vector2Int(1,2), new Vector2Int(2,3), new Vector2Int(3,4), new Vector2Int(4,5), new Vector2Int(5,6), new Vector2Int(6,7), new Vector2Int(6,8), new Vector2Int(8,9), new Vector2Int(9,1), }; float[] sizes = { 0.9f, 2.4f, 0.9f, 2.9f, 0.9f, 0.9f, 2.3f, 0.9f, 0.9f, 2.3f }; Color bright = new Color(1f, 0.95f, 0.6f, 1f); Color normal = new Color(0.8f, 0.8f, 0.8f, 0.6f); Color[] colors = { normal, bright, normal, bright, normal, normal, bright, normal, normal, normal, }; return new ConstellationData( "Ophiuchus", 255f, stars, lines, sizes, colors, new Vector3(-16.076f, 5.857f, 0.398f) ); } private ConstellationData BuildSagittarius() { Vector3[] stars = { new Vector3( 1053, 289, 0), new Vector3( 780, 160, 0), new Vector3( 482, 286, 0), new Vector3( 339, 487, 0), new Vector3( 348, 70, 0), new Vector3( 558, -152, 0), new Vector3( 939, -57, 0), new Vector3( 1127, -157, 0), new Vector3( 1194, -299, 0), new Vector3(1070, -464, 0), new Vector3( 754, -564, 0), new Vector3( 611, -477, 0), new Vector3( 507, -608, 0), new Vector3( 239, -299, 0), new Vector3( 95, -73, 0), new Vector3( -53, 120, 0), new Vector3( -132, 364, 0), new Vector3( -340, -5, 0), new Vector3( -531, -29, 0), new Vector3( -432, 155, 0), new Vector3( -576, 312, 0), new Vector3( -258, -320, 0), new Vector3(-461, -360, 0), }; Vector2Int[] lines = { new Vector2Int(0,1), new Vector2Int(1,2), new Vector2Int(2,3), new Vector2Int(2,4), new Vector2Int(4,5), new Vector2Int(5,6), new Vector2Int(6,7), new Vector2Int(7,8), new Vector2Int(8,9), new Vector2Int(9,10), new Vector2Int(10,11), new Vector2Int(10,12), new Vector2Int(5,13), new Vector2Int(13,14), new Vector2Int(14,4), new Vector2Int(14,15), new Vector2Int(15,16), new Vector2Int(15,17), new Vector2Int(17,18), new Vector2Int(18,19), new Vector2Int(19,20), new Vector2Int(17,21), new Vector2Int(21,22), }; float[] sizes = { 0.8f, 0.8f, 0.9f, 2.4f, 2.0f, 1.0f, 2.2f, 0.9f, 0.9f, 0.9f, 2.3f, 0.9f, 0.9f, 2.1f, 1.1f, 2.3f, 1.0f, 2.0f, 0.9f, 0.9f, 0.8f, 2.4f, 0.9f, 0.9f, }; Color bright = new Color(1f, 0.95f, 0.6f, 1f); Color normal = new Color(0.8f, 0.8f, 0.8f, 0.6f); Color[] colors = { normal, normal, normal, bright, bright, normal, bright, normal, normal, bright, normal, normal, bright, normal, bright, normal, bright, normal, normal, normal, bright, normal, normal }; return new ConstellationData( "Sagittarius", 240f, stars, lines, sizes, colors, new Vector3(0f, 0f, 0f) ); } private ConstellationData BuildCapricorn() { Vector3[] stars = { new Vector3( 242, 963, -2386), new Vector3( 439, 161, -2386), new Vector3( 597, 16, -2386), new Vector3( 779, -171, -2386), new Vector3( 746, -335, -2386), new Vector3( 546, -167,-2386), new Vector3( 325, -231, -2386), new Vector3( 149, -52, -2386), new Vector3( -71, -94,-2386), new Vector3( 0, 199,-2386), }; Vector2Int[] lines = { new Vector2Int(0,1), new Vector2Int(1,2), new Vector2Int(2,3), new Vector2Int(3,4), new Vector2Int(4,5), new Vector2Int(5,6), new Vector2Int(6,7), new Vector2Int(7,8), new Vector2Int(8,9), new Vector2Int(9,0), }; float[] sizes = { 2.4f, 0.9f, 0.9f, 0.9f, 2.2f, 1.0f, 2.3f, 0.9f, 0.9f, 0.9f, }; Color bright = new Color(1f, 0.95f, 0.6f, 1f); Color normal = new Color(0.8f, 0.8f, 0.8f, 0.6f); Color[] colors = { bright, normal, normal, normal, bright, normal, bright, normal, normal, normal }; return new ConstellationData( "Capricornus", 270f, stars, lines, sizes, colors, new Vector3(-21.701f, 0f, 62.368f) ); } private ConstellationData BuildAquarius() { Vector3[] stars = { new Vector3( -746, 577, 0), new Vector3( -133, 245, 0), new Vector3( 768, 199, 0), new Vector3( 481, -223, 0), new Vector3( -294, -98, 0), new Vector3( 989, -77, 0), new Vector3(1189, 32, 0), new Vector3( 1284, -151, 0), new Vector3(1101, -373, 0), new Vector3( 824, -399, 0), new Vector3( 353, -600, 0), new Vector3( 57, -1023, 0), new Vector3( -404, -1166, 0), }; Vector2Int[] lines = { new Vector2Int(0,1), new Vector2Int(1,2), new Vector2Int(2,3), new Vector2Int(3,4), new Vector2Int(2,5), new Vector2Int(5,6), new Vector2Int(6,7), new Vector2Int(7,8), new Vector2Int(8,9), new Vector2Int(9,10), new Vector2Int(10,11), new Vector2Int(11,12), }; float[] sizes = { 2.4f, 0.9f, 2.3f, 0.9f, 2.2f, 1.0f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, }; Color bright = new Color(1f, 0.95f, 0.6f, 1f); Color normal = new Color(0.8f, 0.8f, 0.8f, 0.6f); Color[] colors = { bright, normal, bright, normal, bright, normal, normal, normal, normal, normal, normal, normal, normal, }; return new ConstellationData( "Aquarius", 300f, stars, lines, sizes, colors, new Vector3(-20.202f, -32.193f, 46.899f) ); } private ConstellationData BuildPisces() { Vector3[] stars = { new Vector3(1185, 434, 0), new Vector3(1046, 571, 0), new Vector3(829, 658, 0), new Vector3( 667, 537, 0), new Vector3( 626, 333, 0), new Vector3(821, 177, 0), new Vector3(1124, 197, 0), new Vector3(869, -80, 0), new Vector3(547, -378, 0), new Vector3( 336, -471, 0), new Vector3( 62, -703, 0), new Vector3(-126, -1053, 0), new Vector3(275, -941, 0), new Vector3( 754, -862, 0), new Vector3( 1199, -698, 0), new Vector3(1437, -747, 0), new Vector3( 1530,-528, 0), }; Vector2Int[] lines = { new Vector2Int(0,1), new Vector2Int(1,2), new Vector2Int(2,3), new Vector2Int(3,4), new Vector2Int(4,5), new Vector2Int(5,6), new Vector2Int(6,0), new Vector2Int(6,7), new Vector2Int(7,8), new Vector2Int(8,9), new Vector2Int(9,10), new Vector2Int(10,11), new Vector2Int(11,12), new Vector2Int(12,13), new Vector2Int(13,14), new Vector2Int(14,15), new Vector2Int(15,16), }; float[] sizes = { 2.4f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 2.2f, 0.9f, 0.9f, 0.9f, 2.3f, 0.9f, 2.2f, 0.9f, 0.9f, 2.4f, }; Color bright = new Color(1f, 0.95f, 0.6f, 1f); Color normal = new Color(0.8f, 0.8f, 0.8f, 0.6f); Color[] colors = { bright, normal, normal, normal, normal, normal, normal, bright, normal, normal, normal, bright, normal, bright, normal, normal, bright, }; return new ConstellationData( "Pisces", 330f, stars, lines, sizes, colors, new Vector3(-4.363f, -55.332f, 74.972f) ); } private void CreateConstellation(ConstellationData data, float tilt) { GameObject root = new GameObject("Zodiac_" + data.name); root.transform.SetParent(transform); root.transform.position = GetEclipticPosition(data.lon, tilt, distance); root.transform.LookAt(Vector3.zero); root.transform.Rotate(data.rotation, Space.Self); if (data.name == "Virgo") { root.transform.position = new Vector3(-65967f, 16870f, 10863f); } if (data.name == "Pisces") { root.transform.rotation = Quaternion.Euler(-4.363f, -55.332f, 74.972f); } if (data.name == "Scorpius") { root.transform.position = new Vector3(-61863f, -12959.34f, -19281f); } GameObject[] starObjects = new GameObject[data.stars.Length]; for (int i = 0; i < data.stars.Length; i++) { GameObject star = Instantiate(starPrefab, root.transform); star.transform.localPosition = data.stars[i] * constellationScale; star.transform.localScale = Vector3.one * starSize * data.sizes[i]; ParticleSystem ps = star.GetComponentInChildren(); if (ps != null) { var main = ps.main; main.startColor = data.colors[i]; } starObjects[i] = star; } for (int i = 0; i < data.lines.Length; i++) { Vector2Int c = data.lines[i]; GameObject lineObj = new GameObject("Line"); lineObj.transform.SetParent(root.transform); lineObj.transform.localPosition = Vector3.zero; lineObj.transform.localRotation = Quaternion.identity; lineObj.transform.localScale = Vector3.one; LineRenderer line = lineObj.AddComponent(); line.material = _lineMaterial; line.startWidth = lineWidth; line.endWidth = lineWidth; line.positionCount = 2; line.useWorldSpace = false; line.numCapVertices = 6; line.numCornerVertices = 6; line.SetPosition(0, starObjects[c.x].transform.localPosition); line.SetPosition(1, starObjects[c.y].transform.localPosition); } // GameObject particles = Instantiate( // constellationParticlesPrefab, // root.transform //); // particles.transform.localPosition = Vector3.zero; // particles.transform.localRotation = Quaternion.identity; // particles.transform.localScale = Vector3.one * 500f; root.transform.localScale = Vector3.one * 13f; } private Vector3 GetEclipticPosition(float longitude, float tilt, float dist) { float lonRad = longitude * Mathf.Deg2Rad; float tiltRad = tilt * Mathf.Deg2Rad; float x = Mathf.Cos(lonRad) * dist; float y = Mathf.Sin(tiltRad) * Mathf.Sin(lonRad) * dist; float z = Mathf.Sin(lonRad) * dist * Mathf.Cos(tiltRad); return new Vector3(x, y, z); } }