From a9d0b2181b4c0bbb88f1077b1ee7bcf5691bb36f Mon Sep 17 00:00:00 2001 From: "Nick J. Connors" Date: Mon, 31 Jan 2022 10:36:10 -0500 Subject: [PATCH] Changed tornado size specification --- NewHorizons/Builder/Body/FunnelBuilder.cs | 1 + NewHorizons/Builder/Body/WaterBuilder.cs | 8 +++ NewHorizons/Builder/Props/TornadoBuilder.cs | 63 +++++++++++++++++---- NewHorizons/Components/TornadoFix.cs | 4 +- NewHorizons/External/PropModule.cs | 3 +- 5 files changed, 65 insertions(+), 14 deletions(-) diff --git a/NewHorizons/Builder/Body/FunnelBuilder.cs b/NewHorizons/Builder/Body/FunnelBuilder.cs index 66dc93d2..be915a32 100644 --- a/NewHorizons/Builder/Body/FunnelBuilder.cs +++ b/NewHorizons/Builder/Body/FunnelBuilder.cs @@ -84,6 +84,7 @@ namespace NewHorizons.Builder.Body { materials[i].SetColor("_FogColor", module.Tint.ToColor()); } + materials[i].renderQueue = 2990; } proxyGO.GetComponentInChildren().materials = materials; diff --git a/NewHorizons/Builder/Body/WaterBuilder.cs b/NewHorizons/Builder/Body/WaterBuilder.cs index ee80e00a..52a37a01 100644 --- a/NewHorizons/Builder/Body/WaterBuilder.cs +++ b/NewHorizons/Builder/Body/WaterBuilder.cs @@ -74,10 +74,12 @@ namespace NewHorizons.Builder.Body fluidVolume.SetValue("_radius", waterSize); fluidVolume.SetValue("_layer", LayerMask.NameToLayer("BassicEffectVolume")); + /* var fogGO = GameObject.Instantiate(GameObject.Find("GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/OceanFog"), waterGO.transform); fogGO.name = "OceanFog"; fogGO.transform.localPosition = Vector3.zero; fogGO.transform.localScale = Vector3.one; + */ if (module.Curve != null) { @@ -90,6 +92,12 @@ namespace NewHorizons.Builder.Body levelController._scaleCurve = curve; } + // TODO: make LOD work + //waterGO.AddComponent(); + //waterGO.AddComponent(); + + // TODO: fix ruleset making the sand bubble pop up + waterGO.transform.localPosition = Vector3.zero; waterGO.SetActive(true); } diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 48a1712c..2ebf096e 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -45,33 +45,74 @@ namespace NewHorizons.Builder.Props tornado.transform.localPosition = Vector3.zero; - var scale = Vector3.one; var height = 837.0669f; - if (info.scale != null) - { - scale = new Vector3(info.scale.X / 40f, info.scale.Y / 837.0669f, info.scale.Z / 40f); - height = info.scale.Y; - } + if (info.height != 0f) height = info.height; + + var width = 40f; + if (info.width != 0f) width = info.width; + + var scale = new Vector3(width / 40f, height / 837.0669f, width / 40f); tornado.transform.localScale = scale; var tornadoController = tornado.GetComponent(); tornadoController.SetSector(sector); var n = position.normalized; - tornadoController._bottomBone.localPosition = n * elevation; - tornadoController._midBone.localPosition = n * (elevation + height/2f); - tornadoController._topBone.localPosition = n * (elevation + height); + var up = new Vector3(0, 1, 0); + + var h1 = elevation; + var h2 = (elevation + height / 2f); + var h3 = (elevation + height); + + tornadoController._bottomElevation = h1; + tornadoController._bottomStartElevation = h1; + tornadoController._bottomStartPos = n * h1; + tornadoController._bottomBasePos = up * h1; + tornadoController._bottomBone.localPosition = n * h1; + + tornadoController._midElevation = h2; + tornadoController._midStartElevation = h2; + tornadoController._midStartPos = n * h2; + tornadoController._midBasePos = up * h2; + tornadoController._midBone.localPosition = n * h2; + + tornadoController._topElevation = h3; + tornadoController._topStartPos = n * h3; + tornadoController._topBasePos = up * h3; + tornadoController._topBone.localPosition = n * h3; tornadoController._snapBonesToSphere = true; tornadoController._wander = true; tornadoController._wanderRate = 0.02f; - tornadoController._wanderDegreesX = 360f; - tornadoController._wanderDegreesZ = 360f; + tornadoController._wanderDegreesX = 45f; + tornadoController._wanderDegreesZ = 45f; if(!hasClouds) { var fix = tornado.AddComponent(); fix.SetSector(sector); + + var top = tornado.transform.Find("UpTornado/Effects_GD_TornadoCyclone/Tornado_Top"); + + Logger.Log($"{top.name}"); + + // Get rid of the bit that appears above the clouds + GameObject.Destroy(top.transform.Find("Effects_GD_TornadoCloudCap_Large")?.gameObject); + GameObject.Destroy(top.transform.Find("Effects_GD_TornadoCloudCap_Medium")?.gameObject); + GameObject.Destroy(top.transform.Find("Effects_GD_TornadoCloudCap_Small")?.gameObject); + + /* + var top_objects = new GameObject[3]; + top_objects[0] = GameObject.Instantiate(top.transform.Find("Effects_GD_TornadoCloudBlend_Large").gameObject, top.transform); + top_objects[1] = GameObject.Instantiate(top.transform.Find("Effects_GD_TornadoCloudBlend_Medium").gameObject, top.transform); + top_objects[2] = GameObject.Instantiate(top.transform.Find("Effects_GD_TornadoCloudBlend_Small").gameObject, top.transform); + + foreach(var obj in top_objects) + { + obj.transform.localPosition = new Vector3(0, -20, 0); + obj.transform.localRotation = Quaternion.Euler(180, 0, 0); + } + */ } tornadoController._startActive = false; diff --git a/NewHorizons/Components/TornadoFix.cs b/NewHorizons/Components/TornadoFix.cs index abc2ef05..3b83ea74 100644 --- a/NewHorizons/Components/TornadoFix.cs +++ b/NewHorizons/Components/TornadoFix.cs @@ -48,12 +48,12 @@ namespace NewHorizons.Components public void OnOccupantEnterSector(SectorDetector _) { - if(!tornadoController._tornadoRoot.activeInHierarchy && !tornadoController._tornadoForming) tornadoController.StartFormation(); + if(!tornadoController._tornadoRoot.activeInHierarchy) tornadoController.StartFormation(); } public void OnOccupantExitSector(SectorDetector _) { - if (!_sector.ContainsOccupant(DynamicOccupant.Player | DynamicOccupant.Probe | DynamicOccupant.Ship) && tornadoController._tornadoRoot.activeInHierarchy) + if (!_sector.ContainsOccupant(DynamicOccupant.Player | DynamicOccupant.Probe | DynamicOccupant.Ship)) { tornadoController.StartCollapse(); } diff --git a/NewHorizons/External/PropModule.cs b/NewHorizons/External/PropModule.cs index 96e5e5de..d58d9945 100644 --- a/NewHorizons/External/PropModule.cs +++ b/NewHorizons/External/PropModule.cs @@ -53,7 +53,8 @@ namespace NewHorizons.External { public float elevation; public MVector3 position; - public MVector3 scale; + public float height; + public float width; public MColor tint; } }