mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
debug stuff
This commit is contained in:
parent
9e0ed34e81
commit
5a18364eda
@ -18,6 +18,7 @@ namespace Marshmallow.Atmosphere
|
|||||||
cloudsTopGO.SetActive(false);
|
cloudsTopGO.SetActive(false);
|
||||||
cloudsTopGO.transform.parent = cloudsMainGO.transform;
|
cloudsTopGO.transform.parent = cloudsMainGO.transform;
|
||||||
cloudsTopGO.transform.localScale = new Vector3(config.TopCloudSize / 2, config.TopCloudSize / 2, config.TopCloudSize / 2);
|
cloudsTopGO.transform.localScale = new Vector3(config.TopCloudSize / 2, config.TopCloudSize / 2, config.TopCloudSize / 2);
|
||||||
|
//AddDebugShape.AddSphere(cloudsTopGO, config.TopCloudSize/2, new Color32(255, 0, 255, 128));
|
||||||
|
|
||||||
MeshFilter topMF = cloudsTopGO.AddComponent<MeshFilter>();
|
MeshFilter topMF = cloudsTopGO.AddComponent<MeshFilter>();
|
||||||
topMF.mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().mesh;
|
topMF.mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().mesh;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ namespace Marshmallow.General
|
|||||||
GV.SetValue("_cutoffAcceleration", 0.1f);
|
GV.SetValue("_cutoffAcceleration", 0.1f);
|
||||||
GV.SetValue("_falloffType", GV.GetType().GetNestedType("FalloffType", BindingFlags.NonPublic).GetField("linear").GetValue(GV));
|
GV.SetValue("_falloffType", GV.GetType().GetNestedType("FalloffType", BindingFlags.NonPublic).GetField("linear").GetValue(GV));
|
||||||
GV.SetValue("_alignmentRadius", 1.5f * upperSurface);
|
GV.SetValue("_alignmentRadius", 1.5f * upperSurface);
|
||||||
|
//Utility.AddDebugShape.AddSphere(gravityGO, 1.5f * upperSurface, new Color32(255, 0, 0, 128));
|
||||||
GV.SetValue("_upperSurfaceRadius", upperSurface);
|
GV.SetValue("_upperSurfaceRadius", upperSurface);
|
||||||
GV.SetValue("_lowerSurfaceRadius", lowerSurface);
|
GV.SetValue("_lowerSurfaceRadius", lowerSurface);
|
||||||
GV.SetValue("_layer", 3);
|
GV.SetValue("_layer", 3);
|
||||||
|
|||||||
@ -25,6 +25,7 @@ namespace Marshmallow.General
|
|||||||
RV.SetValue("_maxTargetDistance", 0);
|
RV.SetValue("_maxTargetDistance", 0);
|
||||||
RV.SetValue("_autopilotArrivalDistance", 1000);
|
RV.SetValue("_autopilotArrivalDistance", 1000);
|
||||||
RV.SetValue("_autoAlignmentDistance", 1000);
|
RV.SetValue("_autoAlignmentDistance", 1000);
|
||||||
|
//Utility.AddDebugShape.AddSphere(rfGO, 1000, new Color32(0, 255, 0, 128));
|
||||||
RV.SetValue("_hideLandingModePrompt", false);
|
RV.SetValue("_hideLandingModePrompt", false);
|
||||||
RV.SetValue("_matchAngularVelocity", true);
|
RV.SetValue("_matchAngularVelocity", true);
|
||||||
RV.SetValue("_minMatchAngularVelocityDistance", 70);
|
RV.SetValue("_minMatchAngularVelocityDistance", 70);
|
||||||
|
|||||||
@ -96,6 +96,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="External\IPlanetConfig.cs" />
|
<Compile Include="External\IPlanetConfig.cs" />
|
||||||
<Compile Include="External\PlanetConfig.cs" />
|
<Compile Include="External\PlanetConfig.cs" />
|
||||||
|
<Compile Include="Utility\AddDebugShape.cs" />
|
||||||
<Compile Include="Utility\AddToUITable.cs" />
|
<Compile Include="Utility\AddToUITable.cs" />
|
||||||
<Compile Include="Main.cs" />
|
<Compile Include="Main.cs" />
|
||||||
<Compile Include="Atmosphere\AirBuilder.cs" />
|
<Compile Include="Atmosphere\AirBuilder.cs" />
|
||||||
@ -118,6 +119,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Utility\ImageUtilities.cs" />
|
<Compile Include="Utility\ImageUtilities.cs" />
|
||||||
<Compile Include="Utility\Logger.cs" />
|
<Compile Include="Utility\Logger.cs" />
|
||||||
|
<Compile Include="Utility\MakeMeshDoubleFaced.cs" />
|
||||||
<Compile Include="Utility\MarshmallowExtensions.cs" />
|
<Compile Include="Utility\MarshmallowExtensions.cs" />
|
||||||
<Compile Include="Utility\MVector3.cs" />
|
<Compile Include="Utility\MVector3.cs" />
|
||||||
<Compile Include="Utility\MColor32.cs" />
|
<Compile Include="Utility\MColor32.cs" />
|
||||||
|
|||||||
24
Marshmallow/Utility/AddDebugShape.cs
Normal file
24
Marshmallow/Utility/AddDebugShape.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Marshmallow.Utility
|
||||||
|
{
|
||||||
|
static class AddDebugShape
|
||||||
|
{
|
||||||
|
public static void AddSphere(GameObject obj, float radius, Color color)
|
||||||
|
{
|
||||||
|
var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||||
|
sphere.GetComponent<SphereCollider>().enabled = false;
|
||||||
|
sphere.transform.parent = obj.transform;
|
||||||
|
sphere.transform.localScale = new Vector3(radius, radius, radius);
|
||||||
|
|
||||||
|
sphere.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Sprites/Default"));
|
||||||
|
sphere.GetComponent<MeshRenderer>().material.color = color;
|
||||||
|
|
||||||
|
sphere.AddComponent<MakeMeshDoubleFaced>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
Marshmallow/Utility/MakeMeshDoubleFaced.cs
Normal file
52
Marshmallow/Utility/MakeMeshDoubleFaced.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Marshmallow.Utility
|
||||||
|
{
|
||||||
|
class MakeMeshDoubleFaced : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
var mesh = GetComponent<MeshFilter>().mesh;
|
||||||
|
var vertices = mesh.vertices;
|
||||||
|
var uv = mesh.uv;
|
||||||
|
var normals = mesh.normals;
|
||||||
|
var szV = vertices.Length;
|
||||||
|
var newVerts = new Vector3[szV * 2];
|
||||||
|
var newUv = new Vector2[szV * 2];
|
||||||
|
var newNorms = new Vector3[szV * 2];
|
||||||
|
for (var j = 0; j < szV; j++)
|
||||||
|
{
|
||||||
|
// duplicate vertices and uvs:
|
||||||
|
newVerts[j] = newVerts[j + szV] = vertices[j];
|
||||||
|
newUv[j] = newUv[j + szV] = uv[j];
|
||||||
|
// copy the original normals...
|
||||||
|
newNorms[j] = normals[j];
|
||||||
|
// and revert the new ones
|
||||||
|
newNorms[j + szV] = -normals[j];
|
||||||
|
}
|
||||||
|
var triangles = mesh.triangles;
|
||||||
|
var szT = triangles.Length;
|
||||||
|
var newTris = new int[szT * 2]; // double the triangles
|
||||||
|
for (var i = 0; i < szT; i += 3)
|
||||||
|
{
|
||||||
|
// copy the original triangle
|
||||||
|
newTris[i] = triangles[i];
|
||||||
|
newTris[i + 1] = triangles[i + 1];
|
||||||
|
newTris[i + 2] = triangles[i + 2];
|
||||||
|
// save the new reversed triangle
|
||||||
|
var j = i + szT;
|
||||||
|
newTris[j] = triangles[i] + szV;
|
||||||
|
newTris[j + 2] = triangles[i + 1] + szV;
|
||||||
|
newTris[j + 1] = triangles[i + 2] + szV;
|
||||||
|
}
|
||||||
|
mesh.vertices = newVerts;
|
||||||
|
mesh.uv = newUv;
|
||||||
|
mesh.normals = newNorms;
|
||||||
|
mesh.triangles = newTris; // assign triangles last!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user