LocalPosition bug fix

This commit is contained in:
Nick J. Connors 2021-12-19 10:16:24 -05:00
parent 8d7da14a3f
commit 1b8f763969
18 changed files with 20 additions and 60 deletions

View File

@ -59,6 +59,7 @@ namespace NewHorizons.Atmosphere
airGO.AddComponent<AudioVolume>();
}
airGO.transform.localPosition = Vector3.zero;
airGO.SetActive(true);
}
}

View File

@ -12,7 +12,7 @@ namespace NewHorizons.Atmosphere
atmoGO.SetActive(false);
atmoGO.transform.parent = body.transform;
if(atmosphereModule.hasAtmosphere)
if (atmosphereModule.hasAtmosphere)
{
var mat = GameObject.Find("TimberHearth_Body/Atmosphere_TH/AtmoSphere/Atmosphere_LOD0").GetComponent<MeshRenderer>().material;
@ -76,6 +76,7 @@ namespace NewHorizons.Atmosphere
*/
}
atmoGO.transform.localPosition = Vector3.zero;
atmoGO.SetActive(true);
}
}

View File

@ -112,6 +112,7 @@ namespace NewHorizons.Atmosphere
// Fix the rotations once the rest is done
cloudsMainGO.transform.localRotation = Quaternion.Euler(0, 0, 0);
cloudsMainGO.transform.localPosition = Vector3.zero;
cloudsTopGO.SetActive(true);
cloudsBottomGO.SetActive(true);

View File

@ -50,6 +50,7 @@ namespace NewHorizons.Atmosphere
snowGO.SetActive(true);
}
effectsGO.transform.localPosition = Vector3.zero;
effectsGO.SetActive(true);
}
}

View File

@ -64,6 +64,8 @@ namespace NewHorizons.Atmosphere
lodFogSectorProxy.SetSector(sector);
*/
fogGO.transform.localPosition = Vector3.zero;
lodFogGO.transform.localPosition = Vector3.zero;
fogGO.SetActive(true);
lodFogGO.SetActive(true);
}

View File

@ -20,6 +20,7 @@ namespace NewHorizons.Atmosphere
GDSOV.SetValue("_waterOuterRadius", surfaceSize);
GDSOV.SetValue("_waterInnerRadius", 0f);
overrideGO.transform.localPosition = Vector3.zero;
overrideGO.SetActive(true);
}
}

View File

@ -36,6 +36,7 @@ namespace NewHorizons.Atmosphere
ER.SetValue("_material", GameObject.Find("RulesetVolumes_GD").GetComponent<RulesetVolume>().GetValue<Material>("_material"));
ER.SetValue("_cloudMaterial", GameObject.Find("RulesetVolumes_GD").GetComponent<RulesetVolume>().GetValue<Material>("_cloudMaterial"));
volumesGO.transform.localPosition = Vector3.zero;
rulesetGO.SetActive(true);
volumesGO.SetActive(true);
}

View File

@ -18,7 +18,7 @@ namespace NewHorizons.Body
var minSize = 20;
var maxSize = 50;
int count = (int)(2f * Mathf.PI * belt.InnerRadius / (10f * maxSize));
if (count > 400) count = 400;
if (count > 200) count = 200;
Logger.Log($"Making {count} asteroids around {bodyName}");

View File

@ -10,45 +10,10 @@ namespace NewHorizons.Body
GameObject groundGO = GameObject.CreatePrimitive(PrimitiveType.Sphere);
groundGO.transform.parent = body.transform;
groundGO.transform.localScale = new Vector3(groundScale, groundScale, groundScale);
groundGO.transform.localPosition = Vector3.zero;
groundGO.GetComponent<MeshFilter>().mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().mesh;
groundGO.GetComponent<SphereCollider>().radius = 1f;
groundGO.SetActive(true);
/*
GameObject sphere = new GameObject();
Debug.LogError("1");
sphere.SetActive(false);
Debug.LogError("2");
MeshFilter mf = sphere.AddComponent<MeshFilter>();
Debug.LogError("3");
mf.mesh = mesh;
Debug.LogError("4");
MeshRenderer mr = sphere.AddComponent<MeshRenderer>();
Debug.LogError("5");
mr.material = new Material(Shader.Find("Standard"));
Debug.LogError("6");
sphere.transform.parent = body.transform;
Debug.LogError("7");
sphere.transform.localScale = new Vector3(groundScale, groundScale, groundScale);
Debug.LogError("8");
sphere.SetActive(true);
Debug.LogError("9");
*/
/*
var geo = MainClass.assetBundle.LoadAsset<GameObject>("PLANET");
GameObject temp = GameObject.CreatePrimitive(PrimitiveType.Sphere);
geo.GetComponent<Renderer>().material = temp.GetComponent<Renderer>().material;
GameObject.Destroy(temp);
geo.transform.parent = body.transform;
geo.transform.localScale = new Vector3(1,1,1);
geo.transform.localPosition = new Vector3(0, 0, 0);
Debug.LogError(geo.name);
Debug.LogError(geo.GetComponent<MeshFilter>().mesh.name);
Debug.LogError(geo.transform.parent.name);
geo.SetActive(true);
*/
}
}
}

View File

@ -48,25 +48,7 @@ namespace NewHorizons.Body
// Fix rotation in the end
cubeSphere.transform.localRotation = Quaternion.Euler(90, 0, 0);
/*
GameObject icosphere = new GameObject("Icosphere");
icosphere.transform.parent = go.transform;
icosphere.transform.rotation = Quaternion.Euler(90, 0, 0);
Mesh mesh = Icosphere.Build(5, heightMap, module.MinHeight, module.MaxHeight);
icosphere.AddComponent<MeshFilter>();
icosphere.GetComponent<MeshFilter>().mesh = mesh;
var cubeSphereMR = icosphere.AddComponent<MeshRenderer>();
cubeSphereMR.material = new Material(Shader.Find("Standard"));
cubeSphereMR.material.mainTexture = textureMap;
var cubeSphereMC = icosphere.AddComponent<MeshCollider>();
cubeSphereMC.sharedMesh = mesh;
icosphere.transform.localRotation = Quaternion.Euler(90, 0, 0);
*/
cubeSphere.transform.localPosition = Vector3.zero;
}
}
}

View File

@ -16,6 +16,7 @@ namespace NewHorizons.Body
GameObject icosphere = new GameObject("Icosphere");
icosphere.transform.parent = go.transform;
icosphere.transform.rotation = Quaternion.Euler(90, 0, 0);
icosphere.transform.localPosition = Vector3.zero;
Mesh mesh = Icosphere.Build(3, module.Scale, module.Scale * 1.2f);

View File

@ -79,6 +79,7 @@ namespace NewHorizons.Body
fog3.GetComponent<MeshRenderer>().material.color = new Color32(0, 75, 50, 5);
*/
waterGO.transform.localPosition = Vector3.zero;
waterGO.SetActive(true);
}
}

View File

@ -12,6 +12,7 @@ namespace NewHorizons.General
GameObject detectorGO = new GameObject("FieldDetector");
detectorGO.SetActive(false);
detectorGO.transform.parent = body.transform;
detectorGO.transform.localPosition = Vector3.zero;
detectorGO.layer = 20;
ConstantForceDetector CFD = detectorGO.AddComponent<ConstantForceDetector>();

View File

@ -11,6 +11,7 @@ namespace NewHorizons.General
{
GameObject gravityGO = new GameObject("GravityWell");
gravityGO.transform.parent = body.transform;
gravityGO.transform.localPosition = Vector3.zero;
gravityGO.layer = 17;
gravityGO.SetActive(false);

View File

@ -12,6 +12,7 @@ namespace NewHorizons.General
{
GameObject orbitGO = new GameObject("Orbit");
orbitGO.transform.parent = body.transform;
orbitGO.transform.localPosition = Vector3.zero;
var LR = orbitGO.AddComponent<LineRenderer>();

View File

@ -11,6 +11,7 @@ namespace NewHorizons.General
{
GameObject rfGO = new GameObject("RFVolume");
rfGO.transform.parent = body.transform;
rfGO.transform.localPosition = Vector3.zero;
rfGO.layer = 19;
rfGO.SetActive(false);

View File

@ -13,6 +13,7 @@ namespace NewHorizons.Body
GameObject sectorGO = new GameObject("Sector");
sectorGO.SetActive(false);
sectorGO.transform.parent = body.transform;
sectorGO.transform.localPosition = Vector3.zero;
SphereShape SS = sectorGO.AddComponent<SphereShape>();
SS.SetCollisionMode(Shape.CollisionMode.Volume);

View File

@ -92,15 +92,13 @@ namespace NewHorizons
try
{
existingPlanet = AstroObjectLocator.GetAstroObject(stringID);
if (existingPlanet == null)
existingPlanet = existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.Name.Replace(" ", ""));
if (existingPlanet == null) existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.Name.Replace(" ", ""));
}
catch (Exception e)
{
Logger.LogWarning($"Error when looking for {body.Config.Name}: {e.Message}, {e.StackTrace}");
}
if (existingPlanet != null)
{
try