├── .gitignore ├── Assets ├── Editor.meta ├── Editor │ ├── SpaceShipGeneratorInspector.cs │ └── SpaceShipGeneratorInspector.cs.meta ├── Generator.meta ├── Generator │ ├── BowyerWatson.cs │ ├── BowyerWatson.cs.meta │ ├── GenMesh.cs │ ├── GenMesh.cs.meta │ ├── GenMeshComplexFace.cs │ ├── GenMeshComplexFace.cs.meta │ ├── GenMeshFace.cs │ ├── GenMeshFace.cs.meta │ ├── GenMeshFactory.cs │ ├── GenMeshFactory.cs.meta │ ├── GenMeshSquareFace.cs │ ├── GenMeshSquareFace.cs.meta │ ├── GenMeshTriangleFace.cs │ ├── GenMeshTriangleFace.cs.meta │ ├── GenMeshVertex.cs │ ├── GenMeshVertex.cs.meta │ ├── SpaceShipGenerator.cs │ ├── SpaceShipGenerator.cs.meta │ ├── Triangle.cs │ ├── Triangle.cs.meta │ ├── TriangleEdge.cs │ └── TriangleEdge.cs.meta ├── Scenes.meta └── Scenes │ ├── SampleScene.unity │ └── SampleScene.unity.meta ├── Images └── scr1.png ├── LICENSE.md ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio cache directory 9 | .vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | *.opendb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | *.pdb.meta 30 | 31 | # Unity3D Generated File On Crash Reports 32 | sysinfo.txt 33 | 34 | # Builds 35 | *.apk 36 | *.unitypackage -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f99f884c5f5e6ff4e9a603839511727a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor/SpaceShipGeneratorInspector.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace ProceduralSpaceShip.Editor 5 | { 6 | [CustomEditor(typeof(SpaceShipGenerator))] 7 | public class SpaceShipGeneratorInspector : UnityEditor.Editor 8 | { 9 | public override void OnInspectorGUI() 10 | { 11 | base.OnInspectorGUI(); 12 | 13 | var myTarget = (SpaceShipGenerator)target; 14 | 15 | if (GUILayout.Button("Generate")) 16 | { 17 | myTarget.GenerateMesh(); 18 | } 19 | 20 | if (GUILayout.Button("Generate with new seed")) 21 | { 22 | myTarget.RandomizeSeed(); 23 | myTarget.GenerateMesh(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/Editor/SpaceShipGeneratorInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e1d828d3bcdf8b459b36a55016c40fb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3ec2756675e07e4bae528550934799f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Generator/BowyerWatson.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | 5 | namespace ProceduralSpaceShip 6 | { 7 | public class BowyerWatson 8 | { 9 | public static int[] GetTris(IEnumerable points, bool reverse = false) 10 | { 11 | var pointsList = points.ToList(); 12 | var paths = new List(); 13 | var triangulation = GetTriangles(points); 14 | 15 | var insertedEdges = new List(); 16 | 17 | foreach (var triangle in triangulation) 18 | { 19 | if (!reverse) 20 | { 21 | paths.Add(pointsList.IndexOf(triangle.A)); 22 | paths.Add(pointsList.IndexOf(triangle.B)); 23 | paths.Add(pointsList.IndexOf(triangle.C)); 24 | } 25 | else 26 | { 27 | paths.Add(pointsList.IndexOf(triangle.C)); 28 | paths.Add(pointsList.IndexOf(triangle.B)); 29 | paths.Add(pointsList.IndexOf(triangle.A)); 30 | } 31 | } 32 | 33 | return paths.ToArray(); 34 | } 35 | 36 | public static List GetTriangles(IEnumerable points) 37 | { 38 | var triangulation = new List(); 39 | 40 | // add super triangle 41 | var superTriangle = Triangle.CreateContaining(points); 42 | triangulation.Add(superTriangle); 43 | 44 | foreach (var point in points) 45 | { 46 | var badTriangles = new List(); 47 | 48 | foreach (var triangle in triangulation) 49 | { 50 | if (triangle.IsInsideOfCircumCircle(point)) 51 | { 52 | badTriangles.Add(triangle); 53 | } 54 | } 55 | 56 | var polygon = new List(); 57 | foreach (var triangle in badTriangles) 58 | { 59 | foreach (var edge in triangle.Edges) 60 | { 61 | if (!edge.IsSharedWith(badTriangles, triangle)) 62 | { 63 | polygon.Add(edge); 64 | } 65 | } 66 | } 67 | 68 | foreach (var triangle in badTriangles) 69 | { 70 | triangulation.Remove(triangle); 71 | } 72 | 73 | foreach (var edge in polygon) 74 | { 75 | triangulation.Add(Triangle.CreateFrom(edge, point)); 76 | } 77 | } 78 | 79 | foreach (var triangle in triangulation.ToList()) 80 | { 81 | if (triangle.ContainsAnyPointFrom(superTriangle)) 82 | { 83 | triangulation.Remove(triangle); 84 | } 85 | } 86 | 87 | return triangulation; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Assets/Generator/BowyerWatson.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d58747896628e14789cc5dfc4eaec07 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/GenMesh.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | namespace ProceduralSpaceShip 7 | { 8 | public enum Axis 9 | { 10 | Horizontal, 11 | Vertical 12 | } 13 | 14 | public class GenMesh 15 | { 16 | public GenMeshVertex[] Vertices { get { return Faces.SelectMany(e => e.Vertices).Distinct().ToArray(); } } 17 | public List Faces { get; set; } 18 | 19 | public GenMesh() 20 | { 21 | this.Faces = new List(); 22 | } 23 | 24 | public void Scale(Vector3 scaleVector, GenMeshVertex[] vertices) 25 | { 26 | var center = Vector3.zero; 27 | 28 | foreach (var vert in vertices) 29 | { 30 | center += vert.Coordinates; 31 | } 32 | 33 | center = center / vertices.Count(); 34 | 35 | foreach (var vert in vertices) 36 | { 37 | var centered = vert.Coordinates - center; 38 | vert.Coordinates = new Vector3(centered.x * scaleVector.x, centered.y * scaleVector.y, centered.z * scaleVector.z) + center; 39 | } 40 | } 41 | 42 | public void Translate(Vector3 translation, GenMeshVertex[] vertices) 43 | { 44 | foreach (var vert in vertices) 45 | { 46 | vert.Coordinates += translation; 47 | } 48 | } 49 | 50 | public void Rotate(GenMeshVertex[] vertices, Vector3 center, Quaternion quaterion) 51 | { 52 | foreach (var vert in vertices) 53 | { 54 | var centered = vert.Coordinates - center; 55 | vert.Coordinates = quaterion * vert.Coordinates + center; 56 | } 57 | } 58 | 59 | public GenMeshFace[] ExtrudeDiscreetFace(GenMeshFace face) 60 | { 61 | var faces = face.Extrude(); 62 | 63 | foreach (var addedFace in faces) 64 | { 65 | this.Faces.Add(addedFace); 66 | } 67 | 68 | this.Faces.Remove(face); 69 | 70 | return faces; 71 | } 72 | 73 | public void Scale(Vector3 scaleVector, Matrix4x4 faceSpace, GenMeshVertex[] vertices) 74 | { 75 | // Not sure what Blender does with the space matrix, so I'm gonna skip it for now 76 | var center = Vector3.zero; 77 | 78 | foreach (var vert in vertices) 79 | { 80 | center += vert.Coordinates; 81 | } 82 | 83 | center = center / vertices.Count(); 84 | 85 | foreach (var vert in vertices) 86 | { 87 | var transformedSpace = (vert.Coordinates - center); 88 | vert.Coordinates = (new Vector3(transformedSpace.x * scaleVector.x, transformedSpace.y * scaleVector.y, transformedSpace.z * scaleVector.z)) + center; 89 | } 90 | } 91 | 92 | public Mesh ToUnityMesh(bool smooth = false) 93 | { 94 | var mesh = new Mesh(); 95 | 96 | var faces = smooth 97 | ? this.Faces.ToArray() 98 | : this.Faces.Select(e => e.Clone()).ToArray(); 99 | 100 | var vertices = faces.SelectMany(f => f.Vertices); 101 | 102 | this.IndexAllVertexes(vertices); 103 | var coordinates = vertices.Select(e => e.Coordinates).ToArray(); 104 | 105 | var centerOfMass = Vector3.zero; 106 | foreach (var vertex in coordinates) centerOfMass += vertex; 107 | centerOfMass /= coordinates.Length; 108 | 109 | mesh.vertices = coordinates.Select(v => v - centerOfMass).ToArray(); 110 | mesh.triangles = faces.SelectMany(face => face.GetTriangles()).ToArray(); 111 | 112 | Debug.Log("Vertex count: " + mesh.vertices.Length); 113 | 114 | mesh.RecalculateNormals(); 115 | mesh.RecalculateBounds(); 116 | mesh.RecalculateTangents(); 117 | 118 | return mesh; 119 | } 120 | 121 | private void IndexAllVertexes(IEnumerable vertices) 122 | { 123 | var index = 0; 124 | 125 | foreach (var vertex in vertices) 126 | { 127 | vertex.Index = index; 128 | index++; 129 | } 130 | } 131 | 132 | internal void Symmetrize(Axis axis) 133 | { 134 | // TODO 135 | } 136 | 137 | public GenMeshFace[] Subdivide(GenMeshFace face, int numberOfCuts) 138 | { 139 | var result = face.Subdivide(numberOfCuts); 140 | 141 | this.Faces.Remove(face); 142 | this.Faces.AddRange(result); 143 | 144 | return result; 145 | } 146 | 147 | // from http://wiki.unity3d.com/index.php/3d_Math_functions 148 | public static bool LineLineIntersection(out Vector3 intersection, Vector3 linePoint1, Vector3 lineVec1, Vector3 linePoint2, Vector3 lineVec2) 149 | { 150 | 151 | Vector3 lineVec3 = linePoint2 - linePoint1; 152 | Vector3 crossVec1and2 = Vector3.Cross(lineVec1, lineVec2); 153 | Vector3 crossVec3and2 = Vector3.Cross(lineVec3, lineVec2); 154 | 155 | float planarFactor = Vector3.Dot(lineVec3, crossVec1and2); 156 | 157 | //is coplanar, and not parrallel 158 | if (Mathf.Abs(planarFactor) < 0.0001f && crossVec1and2.sqrMagnitude > 0.0001f) 159 | { 160 | float s = Vector3.Dot(crossVec3and2, crossVec1and2) / crossVec1and2.sqrMagnitude; 161 | intersection = linePoint1 + (lineVec1 * s); 162 | return true; 163 | } 164 | else 165 | { 166 | intersection = Vector3.zero; 167 | return false; 168 | } 169 | } 170 | 171 | public void CreateCylinder(int numberOfSegments, float cylinderSize1, float cylinderSize2, float cylinderDepth, Matrix4x4 cylinderMatrix) 172 | { 173 | var cylinderMesh = GenMeshFactory.CreateCylinder(numberOfSegments, cylinderSize1, cylinderSize2, cylinderDepth); 174 | 175 | foreach (var vertex in cylinderMesh.Vertices) 176 | { 177 | vertex.Coordinates = cylinderMatrix.MultiplyPoint3x4(vertex.Coordinates); 178 | } 179 | 180 | foreach (var face in cylinderMesh.Faces) 181 | { 182 | this.Faces.Add(face); 183 | } 184 | } 185 | 186 | internal void CreateIcosphere(int subdivisions, float sphereSize, Matrix4x4 sphereMatrix) 187 | { 188 | var icosphereMesh = GenMeshFactory.CreateIcosphere(subdivisions, sphereSize); 189 | 190 | foreach (var vertex in icosphereMesh.Vertices) 191 | { 192 | vertex.Coordinates = sphereMatrix.MultiplyPoint3x4(vertex.Coordinates); 193 | } 194 | 195 | foreach (var face in icosphereMesh.Faces) 196 | { 197 | this.Faces.Add(face); 198 | } 199 | } 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /Assets/Generator/GenMesh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a17cb8ae6308094c85ec677016c6f3f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshComplexFace.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | 5 | namespace ProceduralSpaceShip 6 | { 7 | public class GenMeshComplexFace : GenMeshFace 8 | { 9 | private int[] triangles; 10 | 11 | public GenMeshComplexFace(GenMeshVertex[] vertices, int[] triangles) : base(vertices) 12 | { 13 | this.triangles = triangles; 14 | } 15 | 16 | public override Vector3 Normal 17 | { 18 | get 19 | { 20 | throw new System.NotImplementedException(); 21 | } 22 | } 23 | 24 | public override Vector2 Size { get { throw new System.NotImplementedException(); } } 25 | 26 | public override float AspectRatio { get { throw new System.NotImplementedException(); } } 27 | 28 | public override float Width { get { throw new System.NotImplementedException(); } } 29 | 30 | public override float Height { get { throw new System.NotImplementedException(); } } 31 | 32 | public override GenMeshVertex LeftTop { get { throw new System.NotImplementedException(); } } 33 | 34 | public override GenMeshVertex LeftBottom { get { throw new System.NotImplementedException(); } } 35 | 36 | public override GenMeshVertex RightBottom { get { throw new System.NotImplementedException(); } } 37 | 38 | public override GenMeshVertex RightTop { get { throw new System.NotImplementedException(); } } 39 | 40 | public override float Area() 41 | { 42 | throw new System.NotImplementedException(); 43 | } 44 | 45 | public override GenMeshFace Clone() 46 | { 47 | return new GenMeshComplexFace(Vertices, triangles); 48 | } 49 | 50 | public override GenMeshFace[] Extrude() 51 | { 52 | throw new System.NotImplementedException(); 53 | } 54 | 55 | public override int[] GetTriangles() 56 | { 57 | return this.triangles.Select(e => Vertices.ElementAt(e).Index).ToArray(); 58 | } 59 | 60 | public override GenMeshFace[] Subdivide(int numberOfCuts) 61 | { 62 | throw new System.NotImplementedException(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshComplexFace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b1c48275acc8ae4aa1771431780298b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshFace.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace ProceduralSpaceShip 4 | { 5 | public abstract class GenMeshFace 6 | { 7 | public abstract Vector3 Normal { get; } 8 | 9 | public abstract Vector2 Size { get; } 10 | 11 | public GenMeshVertex[] Vertices { get; private set; } 12 | public abstract float AspectRatio { get; } 13 | 14 | public int MaterialIndex { get; internal set; } 15 | public abstract float Width { get; } 16 | public abstract float Height { get; } 17 | 18 | public abstract GenMeshVertex LeftTop { get; } 19 | public abstract GenMeshVertex LeftBottom { get; } 20 | public abstract GenMeshVertex RightBottom { get; } 21 | public abstract GenMeshVertex RightTop { get; } 22 | 23 | public GenMeshFace(GenMeshVertex[] vertices) 24 | { 25 | this.Vertices = vertices; 26 | } 27 | 28 | public Vector3 CalculateCenterBounds() 29 | { 30 | var sum = Vector3.zero; 31 | 32 | foreach (var vertex in this.Vertices) 33 | { 34 | sum += vertex.Coordinates; 35 | } 36 | 37 | return sum / this.Vertices.Length; 38 | } 39 | 40 | public abstract GenMeshFace Clone(); 41 | 42 | public abstract int[] GetTriangles(); 43 | 44 | public abstract GenMeshFace[] Extrude(); 45 | 46 | public abstract GenMeshFace[] Subdivide(int numberOfCuts); 47 | 48 | public abstract float Area(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshFace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9fb392046d427849b0b2a92267803f0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | 5 | namespace ProceduralSpaceShip 6 | { 7 | public static class GenMeshFactory 8 | { 9 | public static GenMesh CreateCube(float size = 1) 10 | { 11 | var mesh = new GenMesh(); 12 | 13 | // create 8 vertices the notation is XYZ so for vertex that's on top face on the left top it will be LTT 14 | var LTT = new GenMeshVertex(new Vector3(-size, +size, -size)); 15 | var RTT = new GenMeshVertex(new Vector3(+size, +size, -size)); 16 | var RTB = new GenMeshVertex(new Vector3(+size, +size, +size)); 17 | var LTB = new GenMeshVertex(new Vector3(-size, +size, +size)); 18 | 19 | var LBT = new GenMeshVertex(new Vector3(-size, -size, -size)); 20 | var RBT = new GenMeshVertex(new Vector3(+size, -size, -size)); 21 | var RBB = new GenMeshVertex(new Vector3(+size, -size, +size)); 22 | var LBB = new GenMeshVertex(new Vector3(-size, -size, +size)); 23 | 24 | // create 6 faces 25 | 26 | // top face 27 | mesh.Faces.Add(new GenMeshSquareFace(RTT, RTB, LTB, LTT)); 28 | 29 | // left face 30 | mesh.Faces.Add(new GenMeshSquareFace(LTB, LBB, LBT, LTT)); 31 | 32 | // right face 33 | mesh.Faces.Add(new GenMeshSquareFace(RTT, RBT, RBB, RTB)); 34 | 35 | // front face 36 | mesh.Faces.Add(new GenMeshSquareFace(RTB, RBB, LBB, LTB)); 37 | 38 | // back face 39 | mesh.Faces.Add(new GenMeshSquareFace(LTT, LBT, RBT, RTT)); 40 | 41 | // bottom face 42 | mesh.Faces.Add(new GenMeshSquareFace(LBT, LBB, RBB, RBT)); 43 | 44 | return mesh; 45 | } 46 | 47 | public static GenMesh CreateCylinder(int numberOfSegments, float cylinderSize1, float cylinderSize2, float cylinderDepth) 48 | { 49 | var mesh = new GenMesh(); 50 | var lowerCircle = new List(); 51 | var upperCircle = new List(); 52 | 53 | for (var i = 0; i < numberOfSegments; i++) 54 | { 55 | lowerCircle.Add(new GenMeshVertex(new Vector3( 56 | Mathf.Cos((float)i / numberOfSegments * Mathf.PI * 2) * cylinderSize1 / 2, 57 | Mathf.Sin((float)i / numberOfSegments * Mathf.PI * 2) * cylinderSize1 / 2, 58 | -cylinderDepth / 2 59 | ))); 60 | 61 | upperCircle.Add(new GenMeshVertex(new Vector3( 62 | Mathf.Cos((float)i / numberOfSegments * Mathf.PI * 2) * cylinderSize2 / 2, 63 | Mathf.Sin((float)i / numberOfSegments * Mathf.PI * 2) * cylinderSize2 / 2, 64 | cylinderDepth / 2))); 65 | } 66 | 67 | for (var i = 0; i < numberOfSegments; i++) 68 | { 69 | mesh.Faces.Add(new GenMeshSquareFace( 70 | upperCircle[i], 71 | upperCircle[(i + 1) % numberOfSegments], 72 | lowerCircle[(i + 1) % numberOfSegments], 73 | lowerCircle[i] 74 | )); 75 | } 76 | 77 | mesh.Faces.Add(new GenMeshComplexFace(lowerCircle.ToArray(), 78 | BowyerWatson.GetTris(lowerCircle.Select(e => (Vector2)e.Coordinates * 100)))); 79 | 80 | mesh.Faces.Add(new GenMeshComplexFace(upperCircle.ToArray(), 81 | BowyerWatson.GetTris(lowerCircle.Select(e => (Vector2)e.Coordinates * 100), true))); 82 | 83 | return mesh; 84 | } 85 | 86 | 87 | // Inspired by http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html 88 | public static GenMesh CreateIcosphere(int numberOfSubdivisions, float size) 89 | { 90 | var t = (1.0f + Mathf.Sqrt(5.0f)) / 2.0f; 91 | 92 | var verticies = new Vector3[] 93 | { 94 | new Vector3(-1, t, 0), 95 | new Vector3(1, t, 0), 96 | new Vector3(-1, -t, 0), 97 | new Vector3(1, -t, 0), 98 | 99 | new Vector3(0, -1, t), 100 | new Vector3(0, 1, t), 101 | new Vector3(0, -1, -t), 102 | new Vector3(0, 1, -t), 103 | 104 | new Vector3(t, 0, -1), 105 | new Vector3(t, 0, 1), 106 | new Vector3(-t, 0, -1), 107 | new Vector3(-t, 0, 1) 108 | } 109 | .Select(p => { 110 | var length = Mathf.Sqrt(p.x * p.x + p.y * p.y + p.z * p.z); 111 | return new GenMeshVertex(new Vector3(p.x / length, p.y / length, p.z / length)); 112 | }) 113 | .ToArray(); 114 | 115 | var faces = new List() 116 | { 117 | new GenMeshTriangleFace(verticies[0], verticies[11], verticies[5]), 118 | new GenMeshTriangleFace(verticies[0], verticies[5], verticies[1]), 119 | new GenMeshTriangleFace(verticies[0], verticies[1], verticies[7]), 120 | new GenMeshTriangleFace(verticies[0], verticies[7], verticies[10]), 121 | new GenMeshTriangleFace(verticies[0], verticies[10], verticies[11]), 122 | 123 | new GenMeshTriangleFace(verticies[1], verticies[5], verticies[9]), 124 | new GenMeshTriangleFace(verticies[5], verticies[11], verticies[4]), 125 | new GenMeshTriangleFace(verticies[11], verticies[10], verticies[2]), 126 | new GenMeshTriangleFace(verticies[10], verticies[7], verticies[6]), 127 | new GenMeshTriangleFace(verticies[7], verticies[1], verticies[8]), 128 | 129 | new GenMeshTriangleFace(verticies[3], verticies[9], verticies[4]), 130 | new GenMeshTriangleFace(verticies[3], verticies[4], verticies[2]), 131 | new GenMeshTriangleFace(verticies[3], verticies[2], verticies[6]), 132 | new GenMeshTriangleFace(verticies[3], verticies[6], verticies[8]), 133 | new GenMeshTriangleFace(verticies[3], verticies[8], verticies[9]), 134 | 135 | new GenMeshTriangleFace(verticies[4], verticies[9], verticies[5]), 136 | new GenMeshTriangleFace(verticies[2], verticies[4], verticies[11]), 137 | new GenMeshTriangleFace(verticies[6], verticies[2], verticies[10]), 138 | new GenMeshTriangleFace(verticies[8], verticies[6], verticies[7]), 139 | new GenMeshTriangleFace(verticies[9], verticies[8], verticies[1]) 140 | }; 141 | 142 | var afterSubdivision = new List(); 143 | 144 | foreach (var face in faces) 145 | { 146 | afterSubdivision.AddRange(face.Subdivide(numberOfSubdivisions)); 147 | } 148 | 149 | var allVerticies = afterSubdivision.SelectMany(e => e.Vertices).Distinct(); 150 | 151 | foreach (var v in allVerticies) 152 | { 153 | v.Coordinates = v.Coordinates * size / 2; 154 | } 155 | 156 | return new GenMesh() 157 | { 158 | Faces = afterSubdivision 159 | }; 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshFactory.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b489d91225384b42ac32722f8eee8fc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshSquareFace.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace ProceduralSpaceShip 6 | { 7 | public class GenMeshSquareFace : GenMeshFace 8 | { 9 | public override Vector3 Normal 10 | { 11 | get 12 | { 13 | var a = RightBottom.Coordinates - LeftBottom.Coordinates; 14 | var b = LeftTop.Coordinates - LeftBottom.Coordinates; 15 | 16 | return Vector3.Cross(a, -b).normalized; 17 | } 18 | } 19 | 20 | public override Vector2 Size 21 | { 22 | get 23 | { 24 | var width = Mathf.Abs((LeftTop.Coordinates - RightTop.Coordinates).magnitude); 25 | var height = Mathf.Abs(LeftTop.Coordinates.y - LeftBottom.Coordinates.y); 26 | 27 | return new Vector2(width, height); 28 | } 29 | } 30 | 31 | public override float AspectRatio 32 | { 33 | get 34 | { 35 | var faceAspectRatio = Mathf.Max( 36 | 0.01f, 37 | (LeftTop.Coordinates - RightTop.Coordinates).magnitude / (LeftTop.Coordinates - LeftBottom.Coordinates).magnitude); 38 | 39 | if (faceAspectRatio < 1.0f) 40 | { 41 | faceAspectRatio = 1.0f / faceAspectRatio; 42 | } 43 | 44 | return faceAspectRatio; 45 | } 46 | } 47 | 48 | public override GenMeshVertex LeftTop { get { return Vertices[0]; } } 49 | public override GenMeshVertex LeftBottom { get { return Vertices[1]; } } 50 | public override GenMeshVertex RightBottom { get { return Vertices[2]; } } 51 | public override GenMeshVertex RightTop { get { return Vertices[3]; } } 52 | 53 | public override float Width { get { return (RightTop.Coordinates - LeftTop.Coordinates).magnitude; } } 54 | public override float Height { get { return (LeftBottom.Coordinates - LeftTop.Coordinates).magnitude; } } 55 | 56 | public GenMeshSquareFace() : base(new GenMeshVertex[4]) 57 | { 58 | } 59 | 60 | public GenMeshSquareFace(GenMeshVertex leftTop, GenMeshVertex leftBottom, GenMeshVertex rightBottom, GenMeshVertex rightTop) : this() 61 | { 62 | this.Vertices[0] = leftTop; 63 | this.Vertices[1] = leftBottom; 64 | this.Vertices[2] = rightBottom; 65 | this.Vertices[3] = rightTop; 66 | } 67 | 68 | public override GenMeshFace Clone() 69 | { 70 | return new GenMeshSquareFace( 71 | this.LeftTop.Clone(), 72 | this.LeftBottom.Clone(), 73 | this.RightBottom.Clone(), 74 | this.RightTop.Clone() 75 | ); 76 | } 77 | 78 | public override int[] GetTriangles() 79 | { 80 | return new int[] 81 | { 82 | LeftTop.Index, 83 | RightBottom.Index, 84 | LeftBottom.Index, 85 | 86 | LeftTop.Index, 87 | RightTop.Index, 88 | RightBottom.Index, 89 | }; 90 | } 91 | 92 | public override GenMeshFace[] Extrude() 93 | { 94 | var frontFace = this.Clone() as GenMeshSquareFace; 95 | var leftFace = new GenMeshSquareFace(this.LeftTop, this.LeftBottom, frontFace.LeftBottom, frontFace.LeftTop); 96 | var topFace = new GenMeshSquareFace(this.LeftTop, frontFace.LeftTop, frontFace.RightTop, this.RightTop); 97 | var rightFace = new GenMeshSquareFace(frontFace.RightTop, frontFace.RightBottom, this.RightBottom, this.RightTop); 98 | var bottomFace = new GenMeshSquareFace(frontFace.LeftBottom, this.LeftBottom, this.RightBottom, frontFace.RightBottom); 99 | 100 | return new GenMeshFace[] 101 | { 102 | frontFace, 103 | leftFace, 104 | topFace, 105 | rightFace, 106 | bottomFace 107 | }; 108 | } 109 | 110 | public override GenMeshFace[] Subdivide(int numberOfCuts) 111 | { 112 | var steps = numberOfCuts + 2; 113 | 114 | var topSize = (this.RightTop.Coordinates - this.LeftTop.Coordinates).magnitude; 115 | var bottomSize = (this.RightBottom.Coordinates - this.LeftBottom.Coordinates).magnitude; 116 | var leftSize = (this.LeftTop.Coordinates - this.LeftBottom.Coordinates).magnitude; 117 | var rightSize = (this.RightTop.Coordinates - this.RightBottom.Coordinates).magnitude; 118 | 119 | var result = new List(); 120 | 121 | var topPoints = new List(); 122 | var bottomPoints = new List(); 123 | var leftPoints = new List(); 124 | var rightPoints = new List(); 125 | 126 | 127 | for (var i = 0; i < steps; i++) 128 | { 129 | // horizontal 130 | var hfrom = Vector3.Lerp(this.LeftTop.Coordinates, this.RightTop.Coordinates, ((float)i) / (steps - 1)); 131 | var hto = Vector3.Lerp(this.LeftBottom.Coordinates, this.RightBottom.Coordinates, ((float)i) / (steps - 1)); 132 | 133 | // vertical 134 | var vfrom = Vector3.Lerp(this.LeftTop.Coordinates, this.LeftBottom.Coordinates, ((float)i) / (steps - 1)); 135 | var vto = Vector3.Lerp(this.RightTop.Coordinates, this.RightBottom.Coordinates, ((float)i) / (steps - 1)); 136 | 137 | topPoints.Add(hfrom); 138 | bottomPoints.Add(hto); 139 | leftPoints.Add(vfrom); 140 | rightPoints.Add(vto); 141 | } 142 | 143 | var points = new Vector3[steps, steps]; 144 | 145 | for (var x = 0; x < steps; x++) 146 | { 147 | for (var y = 0; y < steps; y++) 148 | { 149 | var top = topPoints[x]; 150 | var bottom = bottomPoints[x]; 151 | var left = leftPoints[y]; 152 | var right = rightPoints[y]; 153 | 154 | Vector3 intersection; 155 | if (!GenMesh.LineLineIntersection(out intersection, top, (bottom - top), left, (right - left))) 156 | { 157 | throw new InvalidOperationException("Points here should always intersect"); 158 | } 159 | 160 | points[x, y] = intersection; 161 | } 162 | } 163 | 164 | for (var x = 0; x < steps - 1; x++) 165 | { 166 | for (var y = 0; y < steps - 1; y++) 167 | { 168 | result.Add(new GenMeshSquareFace( 169 | new GenMeshVertex(points[x, y]), 170 | new GenMeshVertex(points[x, y + 1]), 171 | new GenMeshVertex(points[x + 1, y + 1]), 172 | new GenMeshVertex(points[x + 1, y]))); 173 | } 174 | } 175 | 176 | return result.ToArray(); 177 | } 178 | 179 | public override float Area() 180 | { 181 | return this.Width * this.Height; 182 | } 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshSquareFace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14a6cdd914fbf514d8799fc1af259474 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshTriangleFace.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | 5 | namespace ProceduralSpaceShip 6 | { 7 | public class GenMeshTriangleFace : GenMeshFace 8 | { 9 | public GenMeshTriangleFace(GenMeshVertex a, GenMeshVertex b, GenMeshVertex c) : base(new GenMeshVertex[] { a, b, c }) 10 | { 11 | } 12 | 13 | public override Vector3 Normal 14 | { 15 | get 16 | { 17 | throw new System.NotImplementedException(); 18 | } 19 | } 20 | 21 | public override Vector2 Size { get { throw new System.NotImplementedException(); } } 22 | 23 | public override float AspectRatio { get { throw new System.NotImplementedException(); } } 24 | 25 | public override float Width { get { throw new System.NotImplementedException(); } } 26 | 27 | public override float Height { get { throw new System.NotImplementedException(); } } 28 | 29 | public override GenMeshVertex LeftTop { get { throw new System.NotImplementedException(); } } 30 | 31 | public override GenMeshVertex LeftBottom { get { throw new System.NotImplementedException(); } } 32 | 33 | public override GenMeshVertex RightBottom { get { throw new System.NotImplementedException(); } } 34 | 35 | public override GenMeshVertex RightTop { get { throw new System.NotImplementedException(); } } 36 | 37 | public override float Area() 38 | { 39 | throw new System.NotImplementedException(); 40 | } 41 | 42 | public override GenMeshFace Clone() 43 | { 44 | return new GenMeshTriangleFace(this.Vertices[0].Clone(), this.Vertices[1].Clone(), this.Vertices[2].Clone()); 45 | } 46 | 47 | public override GenMeshFace[] Extrude() 48 | { 49 | throw new System.NotImplementedException(); 50 | } 51 | 52 | public override int[] GetTriangles() 53 | { 54 | return new int[] 55 | { 56 | this.Vertices[0].Index, 57 | this.Vertices[1].Index, 58 | this.Vertices[2].Index 59 | }; 60 | } 61 | 62 | public override GenMeshFace[] Subdivide(int numberOfCuts) 63 | { 64 | var faces = new List() { this }; 65 | 66 | for (var i = 0; i < numberOfCuts; i++) 67 | { 68 | var tmpFaces = faces.ToList(); 69 | faces.Clear(); 70 | 71 | foreach (var face in tmpFaces.ToList()) 72 | { 73 | var a = GetMidpoint(face.Vertices[1], face.Vertices[0]); 74 | var b = GetMidpoint(face.Vertices[2], face.Vertices[1]); 75 | var c = GetMidpoint(face.Vertices[0], face.Vertices[2]); 76 | 77 | 78 | faces.Add(new GenMeshTriangleFace(face.Vertices[0], new GenMeshVertex(a), new GenMeshVertex(c))); 79 | faces.Add(new GenMeshTriangleFace(face.Vertices[1], new GenMeshVertex(b), new GenMeshVertex(a))); 80 | faces.Add(new GenMeshTriangleFace(face.Vertices[2], new GenMeshVertex(c), new GenMeshVertex(b))); 81 | faces.Add(new GenMeshTriangleFace(new GenMeshVertex(a), new GenMeshVertex(b), new GenMeshVertex(c))); 82 | } 83 | } 84 | 85 | return faces.ToArray(); 86 | } 87 | 88 | private static Vector3 GetMidpoint(GenMeshVertex a, GenMeshVertex b) 89 | { 90 | var p = (a.Coordinates + b.Coordinates) / 2; 91 | 92 | var length = Mathf.Sqrt(p.x * p.x + p.y * p.y + p.z * p.z); 93 | 94 | return new Vector3(p.x / length, p.y / length, p.z / length); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshTriangleFace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f69a9c1e3c853284e97387e80e549a86 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshVertex.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace ProceduralSpaceShip 4 | { 5 | public class GenMeshVertex 6 | { 7 | public Vector3 Coordinates { get; set; } 8 | public int Index { get; set; } 9 | 10 | public GenMeshVertex() 11 | { 12 | 13 | } 14 | 15 | public GenMeshVertex(Vector3 coordinates) 16 | { 17 | this.Coordinates = coordinates; 18 | } 19 | 20 | internal GenMeshVertex Clone() 21 | { 22 | return new GenMeshVertex(this.Coordinates); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Assets/Generator/GenMeshVertex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8fe6dc638b4c7449ad67603634e82b9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/SpaceShipGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | 5 | namespace ProceduralSpaceShip 6 | { 7 | public class SpaceShipGenerator : MonoBehaviour 8 | { 9 | [SerializeField] 10 | private bool smoothShading = false; 11 | 12 | [SerializeField] 13 | private int seed = 844483692; 14 | 15 | [SerializeField] 16 | private int numHullSegmentsMin = 3; 17 | 18 | [SerializeField] 19 | private int numHullSegmentsMax = 6; 20 | 21 | [SerializeField] 22 | private bool createAsymmetrySegments = true; 23 | 24 | [SerializeField] 25 | private int numAsymmetrySegmentsMin = 1; 26 | 27 | [SerializeField] 28 | private int numAsymmetrySegmentsMax = 5; 29 | 30 | [SerializeField] 31 | private bool createFaceDetail = true; 32 | 33 | [SerializeField] 34 | private bool allowHorizontalSymmetry = true; 35 | 36 | [SerializeField] 37 | private bool allowVerticalSymmetry = true; 38 | 39 | [SerializeField] 40 | private bool applyBevelModifier = true; 41 | 42 | [SerializeField] 43 | private bool assignMaterials = true; 44 | 45 | public void RandomizeSeed() 46 | { 47 | seed = Random.Range(0, int.MaxValue); 48 | } 49 | 50 | public void GenerateMesh() 51 | { 52 | Random.InitState(this.seed); 53 | 54 | var mesh = GenMeshFactory.CreateCube(); 55 | 56 | Generate(mesh); 57 | 58 | var meshFilter = GetComponent(); 59 | 60 | meshFilter.sharedMesh = mesh.ToUnityMesh(smoothShading); 61 | } 62 | 63 | private void Generate(GenMesh genmesh) 64 | { 65 | var scaleFactor = Random.Range(0.75f, 2.0f); 66 | var scaleVector = Vector3.one * scaleFactor; 67 | 68 | genmesh.Scale(scaleVector, genmesh.Vertices); 69 | 70 | var faces = genmesh.Faces.ToArray(); 71 | for (var f = 0; f < faces.Length; f++) 72 | { 73 | var face = faces[f]; 74 | 75 | if (Mathf.Abs(face.Normal.x) > 0.5f) 76 | { 77 | var hullSegmentLength = Random.Range(0.3f, 1.0f); 78 | var numberOfHullSegments = Random.Range(numHullSegmentsMin, numHullSegmentsMax); 79 | 80 | for (var i = 0; i < numberOfHullSegments; i++) 81 | { 82 | var isLastHullSegment = i == numberOfHullSegments - 1; 83 | var val = Random.value; 84 | 85 | if (val > 0.1f) 86 | { 87 | // Most of the time, extrude out the face with some random deviations 88 | face = this.ExtrudeFace(genmesh, face, hullSegmentLength); 89 | 90 | if (Random.value > 0.75f) 91 | { 92 | face = this.ExtrudeFace(genmesh, face, hullSegmentLength * 0.25f); 93 | } 94 | 95 | // Maybe apply some scaling 96 | if (Random.value > 0.5f) 97 | { 98 | var sy = Random.Range(1.2f, 1.5f); 99 | var sz = Random.Range(1.2f, 1.5f); 100 | 101 | if (isLastHullSegment || Random.value > 0.5f) 102 | { 103 | sy = 1f / sy; 104 | sz = 1f / sz; 105 | } 106 | 107 | this.ScaleFace(genmesh, face, 1f, sy, sz); 108 | } 109 | 110 | // Maybe apply some sideways translation 111 | if (Random.value > 0.5f) 112 | { 113 | var sidewaysTranslation = new Vector3(0f, 0f, Random.Range(0.1f, 0.4f) * scaleVector.z * hullSegmentLength); 114 | 115 | if (Random.value > 0.5f) 116 | { 117 | sidewaysTranslation = -sidewaysTranslation; 118 | } 119 | 120 | genmesh.Translate(sidewaysTranslation, face.Vertices); 121 | } 122 | 123 | // Maybe add some rotation around Z axis 124 | if (Random.value > 0.5f) 125 | { 126 | var angle = 5f; 127 | if (Random.value > 0.5f) 128 | { 129 | angle = -angle; 130 | } 131 | 132 | var quaterion = Quaternion.AngleAxis(angle, new Vector3(0, 0, 1)); 133 | genmesh.Rotate(face.Vertices, new Vector3(0, 0, 0), quaterion); 134 | } 135 | } 136 | else 137 | { 138 | // Rarely, create a ribbed section of the hull 139 | var ribScale = Random.Range(0.75f, 0.95f); 140 | face = this.RibbedExtrudeFace(genmesh, face, hullSegmentLength, Random.Range(2, 4), ribScale); 141 | } 142 | } 143 | } 144 | } 145 | 146 | //Add some large asymmetrical sections of the hull that stick out 147 | if (createAsymmetrySegments) 148 | { 149 | var potentialFaces = genmesh.Faces.ToArray(); 150 | for (var f = 0; f < potentialFaces.Length; f++) 151 | { 152 | var face = potentialFaces[f]; 153 | 154 | if (face.AspectRatio > 4f) 155 | { 156 | continue; 157 | } 158 | 159 | if (Random.value > 0.85f) 160 | { 161 | var hullPieceLength = Random.Range(0.1f, 0.4f); 162 | var totalSegments = Random.Range(numAsymmetrySegmentsMin, numAsymmetrySegmentsMax); 163 | 164 | for (var i = 0; i < totalSegments; i++) 165 | { 166 | face = ExtrudeFace(genmesh, face, hullPieceLength); 167 | 168 | // Maybe apply some scaling 169 | if (Random.value > 0.25f) 170 | { 171 | var s = 1f / Random.Range(1.1f, 1.5f); 172 | ScaleFace(genmesh, face, s, s, s); 173 | } 174 | } 175 | } 176 | } 177 | } 178 | 179 | // Now the basic hull shape is built, let's categorize + add detail to all the faces 180 | if (createFaceDetail) 181 | { 182 | var engineFaces = new List(); 183 | var gridFaces = new List(); 184 | var antennaFaces = new List(); 185 | var weaponFaces = new List(); 186 | var sphereFaces = new List(); 187 | var discFaces = new List(); 188 | var cylinderFaces = new List(); 189 | 190 | faces = genmesh.Faces.ToArray(); 191 | for (var f = 0; f < faces.Length; f++) 192 | { 193 | var face = faces[f]; 194 | 195 | // Skip any long thin faces as it'll probably look stupid 196 | if (face.AspectRatio > 3) continue; 197 | 198 | // Spin the wheel! Let's categorize + assign some materials 199 | var val = Random.value; 200 | 201 | if (face.Normal.x < -0.9f) 202 | { 203 | if (!engineFaces.Any() || val > 0.75f) 204 | engineFaces.Add(face); 205 | else if (val > 0.5f) 206 | cylinderFaces.Add(face); 207 | else if (val > 0.25f) 208 | gridFaces.Add(face); 209 | else 210 | face.MaterialIndex = 1;//Material.hull_lights 211 | } 212 | else if (face.Normal.x > 0.9f) // front face 213 | { 214 | if (Vector3.Dot(face.Normal, face.CalculateCenterBounds()) > 0 && val > 0.7f) 215 | { 216 | antennaFaces.Add(face); // front facing antenna 217 | face.MaterialIndex = 1;// Material.hull_lights 218 | } 219 | else if (val > 0.4f) 220 | gridFaces.Add(face); 221 | else 222 | face.MaterialIndex = 1;// Material.hull_lights 223 | } 224 | else if (face.Normal.y > 0.9f) // top face 225 | { 226 | if (Vector3.Dot(face.Normal, face.CalculateCenterBounds()) > 0 && val > 0.7f) 227 | antennaFaces.Add(face); // top facing antenna 228 | else if (val > 0.6f) 229 | gridFaces.Add(face); 230 | else if (val > 0.3f) 231 | cylinderFaces.Add(face); 232 | } 233 | else if (face.Normal.y < -0.9f) // bottom face 234 | { 235 | if (val > 0.75f) 236 | discFaces.Add(face); 237 | else if (val > 0.5f) 238 | gridFaces.Add(face); 239 | else if (val > 0.25f) 240 | weaponFaces.Add(face); 241 | } 242 | else if (Mathf.Abs(face.Normal.z) > 0.9f) // side face 243 | { 244 | if (!weaponFaces.Any() || val > 0.75f) 245 | weaponFaces.Add(face); 246 | else if (val > 0.6f) 247 | gridFaces.Add(face); 248 | else if (val > 0.4f) 249 | sphereFaces.Add(face); 250 | else 251 | face.MaterialIndex = 1;// Material.hull_lights 252 | } 253 | } 254 | 255 | // Now we've categorized, let's actually add the detail 256 | foreach (var fac in engineFaces) 257 | AddExhaustToFace(genmesh, fac); 258 | 259 | foreach (var fac in gridFaces) 260 | AddGridToFace(genmesh, fac); 261 | 262 | foreach (var fac in antennaFaces) 263 | AddSurfaceAntennaToFace(genmesh, fac); 264 | 265 | foreach (var fac in weaponFaces) 266 | AddWeaponsToFace(genmesh, fac); 267 | 268 | foreach (var fac in sphereFaces) 269 | AddSphereToFace(genmesh, fac); 270 | 271 | foreach (var fac in discFaces) 272 | AddDiscToFace(genmesh, fac); 273 | 274 | foreach (var fac in cylinderFaces) 275 | AddCylindersToFace(genmesh, fac); 276 | } 277 | 278 | // Apply horizontal symmetry sometimes 279 | if (allowHorizontalSymmetry && Random.value > 0.5f) 280 | genmesh.Symmetrize(Axis.Horizontal); 281 | 282 | // Apply vertical symmetry sometimes - this can cause spaceship "islands", so disabled by default 283 | if (allowHorizontalSymmetry && Random.value > 0.5f) 284 | genmesh.Symmetrize(Axis.Vertical); 285 | 286 | if (applyBevelModifier) 287 | { 288 | // TODO 289 | } 290 | } 291 | 292 | private Matrix4x4 GetFaceMatrix(GenMeshFace face, Vector3? position = null) 293 | { 294 | var xAxis = (face.RightTop.Coordinates - face.LeftTop.Coordinates).normalized; 295 | var zAxis = -face.Normal; 296 | var yAxis = Vector3.Cross(zAxis, xAxis); 297 | 298 | if (!position.HasValue) 299 | { 300 | position = face.CalculateCenterBounds(); 301 | } 302 | 303 | //return Matrix4x4.Translate(position.Value); 304 | 305 | // Construct a 4x4 matrix from axes + position: 306 | // http://i.stack.imgur.com/3TnQP.png 307 | 308 | var mat = new Matrix4x4(); 309 | mat[0, 0] = xAxis.x; 310 | mat[1, 0] = xAxis.y; 311 | mat[2, 0] = xAxis.z; 312 | mat[3, 0] = 0; 313 | mat[0, 1] = yAxis.x; 314 | mat[1, 1] = yAxis.y; 315 | mat[2, 1] = yAxis.z; 316 | mat[3, 1] = 0; 317 | mat[0, 2] = zAxis.x; 318 | mat[1, 2] = zAxis.y; 319 | mat[2, 2] = zAxis.z; 320 | mat[3, 2] = 0; 321 | mat[0, 3] = position.Value.x; 322 | mat[1, 3] = position.Value.y; 323 | mat[2, 3] = position.Value.z; 324 | mat[3, 3] = 1; 325 | 326 | return mat; 327 | } 328 | 329 | private void AddCylindersToFace(GenMesh genmesh, GenMeshFace fac) 330 | { 331 | var horizontalStep = Random.Range(1, 3); 332 | var verticalStep = Random.Range(1, 3); 333 | var numberOfSegments = Random.Range(6, 12); 334 | var faceWidth = fac.Width; 335 | var faceHeight = fac.Height; 336 | var cylinderDepth = 1.3f * Mathf.Min(faceWidth / (horizontalStep + 2), faceHeight / (verticalStep + 2)); 337 | var cylinderSize = cylinderDepth * 0.5f; 338 | 339 | for (var h = 0; h < horizontalStep; h++) 340 | { 341 | var top = Vector3.Lerp(fac.LeftTop.Coordinates, fac.RightTop.Coordinates, ((float)h + 1) / (horizontalStep + 1)); 342 | var bottom = Vector3.Lerp(fac.LeftBottom.Coordinates, fac.RightBottom.Coordinates, ((float)h + 1) / (horizontalStep + 1)); 343 | 344 | for (var v = 0; v < verticalStep; v++) 345 | { 346 | var pos = Vector3.Lerp(top, bottom, ((float)v + 1) / (verticalStep + 1)); 347 | var cylinderMatrix = GetFaceMatrix(fac, pos) * Matrix4x4.Rotate(Quaternion.AngleAxis(90, new Vector3(0, 1, 0))); 348 | 349 | genmesh.CreateCylinder(numberOfSegments, cylinderSize, cylinderSize, cylinderDepth, cylinderMatrix); 350 | } 351 | } 352 | 353 | } 354 | 355 | private void AddDiscToFace(GenMesh genmesh, GenMeshFace fac) 356 | { 357 | var faceWidth = fac.Width; 358 | var faceHeight = fac.Height; 359 | var depth = 0.125f * Mathf.Min(faceWidth, faceHeight); 360 | 361 | genmesh.CreateCylinder( 362 | 32, 363 | depth * 3, 364 | depth * 4, 365 | depth, 366 | GetFaceMatrix(fac, fac.CalculateCenterBounds() + fac.Normal * depth * 0.5f)); 367 | 368 | genmesh.CreateCylinder( 369 | 32, 370 | depth * 1.25f, 371 | depth * 2.25f, 372 | 0.0f, 373 | GetFaceMatrix(fac, fac.CalculateCenterBounds() + fac.Normal * depth * 1.05f)); 374 | 375 | /* 376 | for vert in result['verts']: 377 | for face in vert.link_faces: 378 | face.material_index = Material.glow_disc 379 | 380 | */ 381 | } 382 | 383 | private void AddSphereToFace(GenMesh genmesh, GenMeshFace fac) 384 | { 385 | var sphereSize = Random.Range(0.4f, 1f) * Mathf.Min(fac.Width, fac.Height); 386 | var sphereMatrix = GetFaceMatrix(fac, fac.CalculateCenterBounds() - fac.Normal * Random.Range(0f, sphereSize * 0.5f)); 387 | genmesh.CreateIcosphere(3, sphereSize, sphereMatrix); 388 | 389 | /* 390 | for vert in result['verts']: 391 | for face in vert.link_faces: 392 | face.material_index = Material.hull 393 | */ 394 | } 395 | 396 | private void AddWeaponsToFace(GenMesh genmesh, GenMeshFace fac) 397 | { 398 | var horizontalStep = Random.Range(1, 3); 399 | var verticalStep = Random.Range(1, 3); 400 | var numSegments = 16; 401 | 402 | var weaponSize = 0.5f * Mathf.Min(fac.Width / (horizontalStep + 2), fac.Height / (verticalStep + 2)); 403 | var weaponDepth = weaponSize * 0.2f; 404 | 405 | for (var h = 0; h < horizontalStep; h++) 406 | { 407 | var top = Vector3.Lerp(fac.LeftTop.Coordinates, fac.RightTop.Coordinates, (float)(h + 1) / (horizontalStep + 1)); 408 | var bottom = Vector3.Lerp(fac.LeftBottom.Coordinates, fac.RightBottom.Coordinates, (float)(h + 1) / (horizontalStep + 1)); 409 | 410 | for (var v = 0; v < verticalStep; v++) 411 | { 412 | var pos = Vector3.Lerp(top, bottom, (float)(v + 1) / (verticalStep + 1)); 413 | var faceMatrix = GetFaceMatrix(fac, pos + fac.Normal * weaponDepth * 0.5f) * 414 | Matrix4x4.Rotate(Quaternion.AngleAxis(Random.Range(0, 90), new Vector3(0, 0, 1))); 415 | 416 | 417 | // Turret foundation 418 | genmesh.CreateCylinder(numSegments, weaponSize * 0.9f, weaponSize, weaponDepth, faceMatrix); 419 | 420 | // Turret left guard 421 | var leftGuardMat = faceMatrix * 422 | Matrix4x4.Rotate(Quaternion.AngleAxis(90, new Vector3(0, 1, 0))) * 423 | Matrix4x4.Translate(new Vector3(0, 0, weaponSize * 0.6f)); 424 | genmesh.CreateCylinder(numSegments, weaponSize * 0.6f, weaponSize * 0.5f, weaponDepth * 2, leftGuardMat); 425 | 426 | // Turret right guard 427 | var rightGuardMat = faceMatrix * 428 | Matrix4x4.Rotate(Quaternion.AngleAxis(90, new Vector3(0, 1, 0))) * 429 | Matrix4x4.Translate(new Vector3(0, 0, weaponSize * -0.6f)); 430 | genmesh.CreateCylinder(numSegments, weaponSize * 0.5f, weaponSize * 0.6f, weaponDepth * 2, rightGuardMat); 431 | 432 | // Turret housing 433 | var upwardAngle = Random.Range(0, 45); 434 | var turretHouseMat = faceMatrix * 435 | Matrix4x4.Rotate(Quaternion.AngleAxis(upwardAngle, new Vector3(1, 0, 0))) * 436 | Matrix4x4.Translate(new Vector3(0, weaponSize * -0.4f, 0)); 437 | genmesh.CreateCylinder(8, weaponSize * 0.4f, weaponSize * 0.4f, weaponDepth * 5, turretHouseMat); 438 | 439 | // Turret barrels L + R 440 | genmesh.CreateCylinder(8, weaponSize * 0.1f, weaponSize * 0.1f, weaponDepth * 6, turretHouseMat * 441 | Matrix4x4.Translate(new Vector3(weaponSize * 0.2f, 0, -weaponSize))); 442 | genmesh.CreateCylinder(8, weaponSize * 0.1f, weaponSize * 0.1f, weaponDepth * 6, turretHouseMat * 443 | Matrix4x4.Translate(new Vector3(weaponSize * -0.2f, 0, -weaponSize))); 444 | } 445 | } 446 | } 447 | 448 | private void AddSurfaceAntennaToFace(GenMesh genmesh, GenMeshFace fac) 449 | { 450 | var horizontalStep = Random.Range(4, 10); 451 | var verticalStep = Random.Range(4, 10); 452 | 453 | for (var h = 0; h < horizontalStep; h++) 454 | { 455 | var top = Vector3.Lerp(fac.LeftTop.Coordinates, fac.RightTop.Coordinates, ((float)h + 1) / (horizontalStep + 1)); 456 | var bottom = Vector3.Lerp(fac.LeftBottom.Coordinates, fac.RightBottom.Coordinates, ((float)h + 1) / (horizontalStep + 1)); 457 | 458 | for (var v = 0; v < verticalStep; v++) 459 | { 460 | if (Random.value > 0.9f) 461 | { 462 | var pos = Vector3.Lerp(top, bottom, ((float)v + 1) / (verticalStep + 1)); 463 | var faceSize = Mathf.Sqrt(fac.Area()); 464 | var depth = Random.Range(0.1f, 1.5f) * faceSize; 465 | var depthShort = depth * Random.Range(0.02f, 0.15f); 466 | var baseDiameter = Random.Range(0.005f, 0.05f); 467 | var materialIndex = Random.value > 0.5f ? 0 /*Material.hull*/ : 1;/*Material.hull_dark*/ 468 | 469 | // Spire 470 | var numSegments = Random.Range(3, 6); 471 | genmesh.CreateCylinder(numSegments, 0, baseDiameter, depth, GetFaceMatrix(fac, pos + fac.Normal * depth * 0.5f)); 472 | 473 | //for vert in result['verts']: 474 | // for vert_face in vert.link_faces: 475 | // vert_face.material_index = material_index 476 | // } 477 | 478 | // Base 479 | genmesh.CreateCylinder( 480 | numSegments, 481 | baseDiameter * Random.Range(1f, 1.5f), 482 | baseDiameter * Random.Range(1.5f, 2f), 483 | depthShort, 484 | GetFaceMatrix(fac, pos + fac.Normal * depthShort * 0.45f)); 485 | 486 | // for vert in result['verts']: 487 | //for vert_face in vert.link_faces: 488 | // vert_face.material_index = material_index 489 | } 490 | } 491 | } 492 | } 493 | 494 | private void AddGridToFace(GenMesh genmesh, GenMeshFace fac) 495 | { 496 | var result = genmesh.Subdivide(fac, Random.Range(2, 4)); 497 | var gridLength = Random.Range(0.025f, 0.15f); 498 | var scale = 0.8f; 499 | 500 | for (var i = 0; i < result.Length; i++) 501 | { 502 | var face = result[i]; 503 | var materialIndex = Random.value > 0.5f ? 1/*Material.hull_lights*/ : 4 /*Material.hull*/; 504 | var extrudedFaceList = new List(); 505 | 506 | face = ExtrudeFace(genmesh, face, gridLength, extrudedFaceList); 507 | 508 | foreach (var f in extrudedFaceList) 509 | { 510 | if (Mathf.Abs(face.Normal.z) < 0.707) // # side face 511 | f.MaterialIndex = materialIndex; 512 | } 513 | 514 | ScaleFace(genmesh, face, scale, scale, scale); 515 | } 516 | } 517 | 518 | // Given a face, splits it into a uniform grid and extrudes each grid face 519 | // out and back in again, making an exhaust shape. 520 | private void AddExhaustToFace(GenMesh genmesh, GenMeshFace faceForExhaust) 521 | { 522 | // The more square the face is, the more grid divisions it might have 523 | var num_cuts = Random.Range(1, (int)(4 - faceForExhaust.AspectRatio)); 524 | var result = genmesh.Subdivide(faceForExhaust, num_cuts); 525 | 526 | var exhaust_length = Random.Range(0.1f, 0.2f); 527 | var scaleOuter = 1f / Random.Range(1.3f, 1.6f); 528 | var scale_inner = 1f / Random.Range(1.05f, 1.1f); 529 | 530 | for (var i = 0; i < result.Count(); i++) 531 | { 532 | var face = result[i]; 533 | face.MaterialIndex = 2;// Material.hull_dark; 534 | 535 | face = ExtrudeFace(genmesh, face, exhaust_length); 536 | ScaleFace(genmesh, face, scaleOuter, scaleOuter, scaleOuter); 537 | 538 | face = ExtrudeFace(genmesh, face, 0); 539 | ScaleFace(genmesh, face, scaleOuter * 0.9f, scaleOuter * 0.9f, scaleOuter * 0.9f); 540 | 541 | var extruded_face_list = new List(); 542 | face = ExtrudeFace(genmesh, face, -exhaust_length * 0.9f, extruded_face_list); 543 | 544 | foreach (var extruded_face in extruded_face_list) 545 | extruded_face.MaterialIndex = 3;// Material.exhaust_burn 546 | 547 | ScaleFace(genmesh, face, scale_inner, scale_inner, scale_inner); 548 | } 549 | } 550 | 551 | private GenMeshFace RibbedExtrudeFace(GenMesh genmesh, GenMeshFace face, float distance, int numberOfRibs = 3, float ribScale = 0.9f) 552 | { 553 | var distancePerRib = distance / numberOfRibs; 554 | var newFace = face; 555 | 556 | for (var i = 0; i < numberOfRibs; i++) 557 | { 558 | newFace = ExtrudeFace(genmesh, newFace, distancePerRib * 0.25f); 559 | newFace = ExtrudeFace(genmesh, newFace, 0.0f); 560 | ScaleFace(genmesh, newFace, ribScale, ribScale, ribScale); 561 | newFace = ExtrudeFace(genmesh, newFace, distancePerRib * 0.5f); 562 | newFace = ExtrudeFace(genmesh, newFace, 0.0f); 563 | ScaleFace(genmesh, newFace, 1 / ribScale, 1 / ribScale, 1 / ribScale); 564 | newFace = ExtrudeFace(genmesh, newFace, distancePerRib * 0.25f); 565 | } 566 | 567 | return newFace; 568 | } 569 | 570 | private void ScaleFace(GenMesh genmesh, GenMeshFace face, float sx, float sy, float sz) 571 | { 572 | genmesh.Scale(new Vector3(sx, sy, sz), GetFaceMatrix(face).inverse, face.Vertices); 573 | } 574 | 575 | private GenMeshFace ExtrudeFace(GenMesh genmesh, GenMeshFace face, float distance, List extrudedFaces = null) 576 | { 577 | var newFaces = genmesh.ExtrudeDiscreetFace(face); 578 | 579 | if (extrudedFaces != null) 580 | { 581 | extrudedFaces.AddRange(newFaces); 582 | } 583 | 584 | var newFace = newFaces[0]; 585 | genmesh.Translate(newFace.Normal * distance, newFace.Vertices); 586 | 587 | return newFace; 588 | } 589 | } 590 | } 591 | -------------------------------------------------------------------------------- /Assets/Generator/SpaceShipGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6357886f791b4b4b9915f57adecbd31 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/Triangle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace ProceduralSpaceShip 8 | { 9 | public class Triangle 10 | { 11 | public Vector2 A { get; set; } 12 | public Vector2 B { get; set; } 13 | public Vector2 C { get; set; } 14 | public IEnumerable Edges { get; private set; } 15 | public Vector2 CircumCenter { get; private set; } 16 | public float CircumRadius { get; private set; } 17 | 18 | public Triangle(Vector2 a, Vector2 b, Vector2 c) 19 | { 20 | this.A = a; 21 | this.B = b; 22 | this.C = c; 23 | 24 | CreateEdges(a, b, c); 25 | CreateCircumCenter(a, b, c); 26 | } 27 | 28 | private void CreateEdges(Vector2 a, Vector2 b, Vector2 c) 29 | { 30 | var edges = new List(); 31 | 32 | edges.Add(new TriangleEdge(a, b)); 33 | edges.Add(new TriangleEdge(b, c)); 34 | edges.Add(new TriangleEdge(a, c)); 35 | 36 | this.Edges = edges; 37 | } 38 | 39 | private float Pow2(float a) 40 | { 41 | return a * a; 42 | } 43 | 44 | private void CreateCircumCenter(Vector2 a, Vector2 b, Vector2 c) 45 | { 46 | var d = 2f * ((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))); 47 | 48 | var uX = 49 | (((Pow2(a.x) + Pow2(a.y)) * (b.y - c.y)) + 50 | ((Pow2(b.x) + Pow2(b.y)) * (c.y - a.y)) + 51 | ((Pow2(c.x) + Pow2(c.y)) * (a.y - b.y))) / d; 52 | 53 | var uY = 54 | (((Pow2(a.x) + Pow2(a.y)) * (c.x - b.x)) + 55 | ((Pow2(b.x) + Pow2(b.y)) * (a.x - c.x)) + 56 | ((Pow2(c.x) + Pow2(c.y)) * (b.x - a.x))) / d; 57 | 58 | this.CircumCenter = new Vector2(uX, uY); 59 | this.CircumRadius = Vector2.Distance(this.CircumCenter, a); 60 | } 61 | 62 | public static Triangle CreateContaining(IEnumerable points) 63 | { 64 | var center = GetCenter(points); 65 | var mostDistantNodeOnX = GetMostDistantNodeOnX(points, center); 66 | var mostDistantNodeOnY = GetMostDistantNodeOnY(points, center); 67 | 68 | var xScale = Mathf.Abs(center.x - mostDistantNodeOnX.x); 69 | var yScale = Mathf.Abs(center.y - mostDistantNodeOnY.y); 70 | 71 | return new Triangle( 72 | new Vector2(center.x - xScale * 100, center.y + yScale * 100), 73 | new Vector2(center.x, center.y - yScale * 100), 74 | new Vector2(center.x + xScale * 100, center.y + yScale * 100) 75 | ); 76 | } 77 | 78 | private static Vector2 GetMostDistantNodeOnX(IEnumerable points, Vector2 center) 79 | { 80 | var point = points.First(); 81 | var dist = 0f; 82 | 83 | foreach (var p in points) 84 | { 85 | if (Mathf.Abs(center.x - p.x) > dist) 86 | { 87 | point = p; 88 | dist = Mathf.Abs(center.x - p.x); 89 | } 90 | } 91 | 92 | return point; 93 | } 94 | 95 | private static Vector2 GetMostDistantNodeOnY(IEnumerable points, Vector2 center) 96 | { 97 | var point = points.First(); 98 | var dist = 0f; 99 | 100 | foreach (var p in points) 101 | { 102 | if (Mathf.Abs(center.y - p.y) > dist) 103 | { 104 | point = p; 105 | dist = Mathf.Abs(center.y - p.y); 106 | } 107 | } 108 | 109 | return point; 110 | } 111 | 112 | private static Vector2 GetCenter(IEnumerable points) 113 | { 114 | var center = Vector2.zero; 115 | 116 | foreach (var point in points) 117 | { 118 | center += point; 119 | } 120 | 121 | center /= points.Count(); 122 | 123 | return center; 124 | } 125 | 126 | public bool IsInsideOfCircumCircle(Vector2 pos) 127 | { 128 | return Vector2.Distance(this.CircumCenter, pos) <= this.CircumRadius; 129 | } 130 | 131 | public static Triangle CreateFrom(TriangleEdge edge, Vector2 point) 132 | { 133 | return new Triangle(point, edge.PointA, edge.PointB); 134 | } 135 | 136 | public bool ContainsAnyPointFrom(Triangle otherTriangle) 137 | { 138 | var points = new List() 139 | { 140 | this.A, 141 | this.B, 142 | this.C, 143 | }; 144 | 145 | var points2 = new List() 146 | { 147 | otherTriangle.A, 148 | otherTriangle.B, 149 | otherTriangle.C, 150 | }; 151 | 152 | return points.Any(p => points2.Any(p2 => p == p2)); 153 | } 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /Assets/Generator/Triangle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0948baa9e29f76146b508112ad6dc3ee 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Generator/TriangleEdge.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace ProceduralSpaceShip 5 | { 6 | public class TriangleEdge 7 | { 8 | public Vector2 PointA { get; private set; } 9 | public Vector2 PointB { get; private set; } 10 | 11 | public TriangleEdge(Vector2 a, Vector2 b) 12 | { 13 | this.PointA = a; 14 | this.PointB = b; 15 | } 16 | 17 | public override bool Equals(object obj) 18 | { 19 | if (!(obj is TriangleEdge)) 20 | { 21 | return false; 22 | } 23 | 24 | var edge = (TriangleEdge)obj; 25 | 26 | return edge.PointA == this.PointA && edge.PointB == this.PointB; 27 | } 28 | 29 | public override int GetHashCode() 30 | { 31 | return base.GetHashCode(); 32 | } 33 | 34 | internal bool IsSharedWith(List otherTriangles, Triangle excluding) 35 | { 36 | foreach (var triangle in otherTriangles) 37 | { 38 | if (triangle != excluding) 39 | { 40 | foreach (var edge in triangle.Edges) 41 | { 42 | if (edge.Equals(this)) 43 | { 44 | return true; 45 | } 46 | } 47 | } 48 | } 49 | 50 | return false; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Assets/Generator/TriangleEdge.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc895e63f6286a542b5b95fb7a2fa249 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f704ae4b4f98ae41a0bce26658850c1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99c9720ab356a0642a771bea13969a05 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Images/scr1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkmarek/unity-spaceship-generator/549e8a5e8ea3777b8d34a9f7d60503d7dd9e2cc0/Images/scr1.png -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Marek Magdziak 4 | 5 | Copyright (c) 2016 Michael Davies 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | [License to a1studmuffin/SpaceshipGenerator from which this work is based on](https://github.com/a1studmuffin/SpaceshipGenerator/blob/master/LICENSE) 26 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/SampleScene.unity 10 | guid: 99c9720ab356a0642a771bea13969a05 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: c1cf8506f04ef2c4a88b64b6c4202eea, 13 | type: 2} 14 | - type: 15 | m_NativeTypeID: 1020 16 | m_ManagedTypePPtr: {fileID: 0} 17 | m_ManagedTypeFallback: 18 | defaultPresets: 19 | - m_Preset: {fileID: 2655988077585873504, guid: 0cd792cc87e492d43b4e95b205fc5cc6, 20 | type: 2} 21 | - type: 22 | m_NativeTypeID: 1006 23 | m_ManagedTypePPtr: {fileID: 0} 24 | m_ManagedTypeFallback: 25 | defaultPresets: 26 | - m_Preset: {fileID: 2655988077585873504, guid: 7a99f8aa944efe94cb9bd74562b7d5f9, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 15 7 | productGUID: 9cd7ca9e48fb1f042a1fc7339eb26d0d 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: procedural-spaceship 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 1 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | tizenShowActivityIndicatorOnLoading: -1 56 | iosAppInBackgroundBehavior: 0 57 | displayResolutionDialog: 1 58 | iosAllowHTTPDownload: 1 59 | allowedAutorotateToPortrait: 1 60 | allowedAutorotateToPortraitUpsideDown: 1 61 | allowedAutorotateToLandscapeRight: 1 62 | allowedAutorotateToLandscapeLeft: 1 63 | useOSAutorotation: 1 64 | use32BitDisplayBuffer: 1 65 | preserveFramebufferAlpha: 0 66 | disableDepthAndStencilBuffers: 0 67 | androidBlitType: 0 68 | defaultIsNativeResolution: 1 69 | macRetinaSupport: 1 70 | runInBackground: 1 71 | captureSingleScreen: 0 72 | muteOtherAudioSources: 0 73 | Prepare IOS For Recording: 0 74 | Force IOS Speakers When Recording: 0 75 | deferSystemGesturesMode: 0 76 | hideHomeButton: 0 77 | submitAnalytics: 1 78 | usePlayerLog: 1 79 | bakeCollisionMeshes: 0 80 | forceSingleInstance: 0 81 | resizableWindow: 0 82 | useMacAppStoreValidation: 0 83 | macAppStoreCategory: public.app-category.games 84 | gpuSkinning: 1 85 | graphicsJobs: 1 86 | xboxPIXTextureCapture: 0 87 | xboxEnableAvatar: 0 88 | xboxEnableKinect: 0 89 | xboxEnableKinectAutoTracking: 0 90 | xboxEnableFitness: 0 91 | visibleInBackground: 1 92 | allowFullscreenSwitch: 1 93 | graphicsJobMode: 0 94 | fullscreenMode: 1 95 | xboxSpeechDB: 0 96 | xboxEnableHeadOrientation: 0 97 | xboxEnableGuest: 0 98 | xboxEnablePIXSampling: 0 99 | metalFramebufferOnly: 0 100 | n3dsDisableStereoscopicView: 0 101 | n3dsEnableSharedListOpt: 1 102 | n3dsEnableVSync: 0 103 | xboxOneResolution: 0 104 | xboxOneSResolution: 0 105 | xboxOneXResolution: 3 106 | xboxOneMonoLoggingLevel: 0 107 | xboxOneLoggingLevel: 1 108 | xboxOneDisableEsram: 0 109 | xboxOnePresentImmediateThreshold: 0 110 | switchQueueCommandMemory: 0 111 | videoMemoryForVertexBuffers: 0 112 | psp2PowerMode: 0 113 | psp2AcquireBGM: 1 114 | m_SupportedAspectRatios: 115 | 4:3: 1 116 | 5:4: 1 117 | 16:10: 1 118 | 16:9: 1 119 | Others: 1 120 | bundleVersion: 0.1 121 | preloadedAssets: [] 122 | metroInputSource: 0 123 | wsaTransparentSwapchain: 0 124 | m_HolographicPauseOnTrackingLoss: 1 125 | xboxOneDisableKinectGpuReservation: 0 126 | xboxOneEnable7thCore: 0 127 | vrSettings: 128 | cardboard: 129 | depthFormat: 0 130 | enableTransitionView: 0 131 | daydream: 132 | depthFormat: 0 133 | useSustainedPerformanceMode: 0 134 | enableVideoLayer: 0 135 | useProtectedVideoMemory: 0 136 | minimumSupportedHeadTracking: 0 137 | maximumSupportedHeadTracking: 1 138 | hololens: 139 | depthFormat: 1 140 | depthBufferSharingEnabled: 0 141 | enable360StereoCapture: 0 142 | oculus: 143 | sharedDepthBuffer: 0 144 | dashSupport: 0 145 | protectGraphicsMemory: 0 146 | useHDRDisplay: 0 147 | m_ColorGamuts: 0000000003000000 148 | targetPixelDensity: 30 149 | resolutionScalingMode: 0 150 | androidSupportedAspectRatio: 1 151 | androidMaxAspectRatio: 2.1 152 | applicationIdentifier: {} 153 | buildNumber: {} 154 | AndroidBundleVersionCode: 1 155 | AndroidMinSdkVersion: 18 156 | AndroidTargetSdkVersion: 0 157 | AndroidPreferredInstallLocation: 1 158 | aotOptions: 159 | stripEngineCode: 1 160 | iPhoneStrippingLevel: 0 161 | iPhoneScriptCallOptimization: 0 162 | ForceInternetPermission: 0 163 | ForceSDCardPermission: 0 164 | CreateWallpaper: 0 165 | APKExpansionFiles: 0 166 | keepLoadedShadersAlive: 0 167 | StripUnusedMeshComponents: 1 168 | VertexChannelCompressionMask: 4054 169 | iPhoneSdkVersion: 988 170 | iOSTargetOSVersionString: 8.0 171 | tvOSSdkVersion: 0 172 | tvOSRequireExtendedGameController: 0 173 | tvOSTargetOSVersionString: 9.0 174 | uIPrerenderedIcon: 0 175 | uIRequiresPersistentWiFi: 0 176 | uIRequiresFullScreen: 1 177 | uIStatusBarHidden: 1 178 | uIExitOnSuspend: 0 179 | uIStatusBarStyle: 0 180 | iPhoneSplashScreen: {fileID: 0} 181 | iPhoneHighResSplashScreen: {fileID: 0} 182 | iPhoneTallHighResSplashScreen: {fileID: 0} 183 | iPhone47inSplashScreen: {fileID: 0} 184 | iPhone55inPortraitSplashScreen: {fileID: 0} 185 | iPhone55inLandscapeSplashScreen: {fileID: 0} 186 | iPhone58inPortraitSplashScreen: {fileID: 0} 187 | iPhone58inLandscapeSplashScreen: {fileID: 0} 188 | iPadPortraitSplashScreen: {fileID: 0} 189 | iPadHighResPortraitSplashScreen: {fileID: 0} 190 | iPadLandscapeSplashScreen: {fileID: 0} 191 | iPadHighResLandscapeSplashScreen: {fileID: 0} 192 | appleTVSplashScreen: {fileID: 0} 193 | appleTVSplashScreen2x: {fileID: 0} 194 | tvOSSmallIconLayers: [] 195 | tvOSSmallIconLayers2x: [] 196 | tvOSLargeIconLayers: [] 197 | tvOSLargeIconLayers2x: [] 198 | tvOSTopShelfImageLayers: [] 199 | tvOSTopShelfImageLayers2x: [] 200 | tvOSTopShelfImageWideLayers: [] 201 | tvOSTopShelfImageWideLayers2x: [] 202 | iOSLaunchScreenType: 0 203 | iOSLaunchScreenPortrait: {fileID: 0} 204 | iOSLaunchScreenLandscape: {fileID: 0} 205 | iOSLaunchScreenBackgroundColor: 206 | serializedVersion: 2 207 | rgba: 0 208 | iOSLaunchScreenFillPct: 100 209 | iOSLaunchScreenSize: 100 210 | iOSLaunchScreenCustomXibPath: 211 | iOSLaunchScreeniPadType: 0 212 | iOSLaunchScreeniPadImage: {fileID: 0} 213 | iOSLaunchScreeniPadBackgroundColor: 214 | serializedVersion: 2 215 | rgba: 0 216 | iOSLaunchScreeniPadFillPct: 100 217 | iOSLaunchScreeniPadSize: 100 218 | iOSLaunchScreeniPadCustomXibPath: 219 | iOSUseLaunchScreenStoryboard: 0 220 | iOSLaunchScreenCustomStoryboardPath: 221 | iOSDeviceRequirements: [] 222 | iOSURLSchemes: [] 223 | iOSBackgroundModes: 0 224 | iOSMetalForceHardShadows: 0 225 | metalEditorSupport: 1 226 | metalAPIValidation: 1 227 | iOSRenderExtraFrameOnPause: 0 228 | appleDeveloperTeamID: 229 | iOSManualSigningProvisioningProfileID: 230 | tvOSManualSigningProvisioningProfileID: 231 | appleEnableAutomaticSigning: 0 232 | iOSRequireARKit: 0 233 | appleEnableProMotion: 0 234 | clonedFromGUID: 56e7a2d3a00f33d44bdd161b773c35b5 235 | templatePackageId: com.unity.template.3d@1.0.0 236 | templateDefaultScene: Assets/Scenes/SampleScene.unity 237 | AndroidTargetArchitectures: 5 238 | AndroidSplashScreenScale: 0 239 | androidSplashScreen: {fileID: 0} 240 | AndroidKeystoreName: 241 | AndroidKeyaliasName: 242 | AndroidTVCompatibility: 1 243 | AndroidIsGame: 1 244 | AndroidEnableTango: 0 245 | androidEnableBanner: 1 246 | androidUseLowAccuracyLocation: 0 247 | m_AndroidBanners: 248 | - width: 320 249 | height: 180 250 | banner: {fileID: 0} 251 | androidGamepadSupportLevel: 0 252 | resolutionDialogBanner: {fileID: 0} 253 | m_BuildTargetIcons: [] 254 | m_BuildTargetPlatformIcons: [] 255 | m_BuildTargetBatching: 256 | - m_BuildTarget: Standalone 257 | m_StaticBatching: 1 258 | m_DynamicBatching: 0 259 | - m_BuildTarget: tvOS 260 | m_StaticBatching: 1 261 | m_DynamicBatching: 0 262 | - m_BuildTarget: Android 263 | m_StaticBatching: 1 264 | m_DynamicBatching: 0 265 | - m_BuildTarget: iPhone 266 | m_StaticBatching: 1 267 | m_DynamicBatching: 0 268 | - m_BuildTarget: WebGL 269 | m_StaticBatching: 0 270 | m_DynamicBatching: 0 271 | m_BuildTargetGraphicsAPIs: 272 | - m_BuildTarget: AndroidPlayer 273 | m_APIs: 0b00000015000000 274 | m_Automatic: 0 275 | - m_BuildTarget: iOSSupport 276 | m_APIs: 10000000 277 | m_Automatic: 0 278 | - m_BuildTarget: AppleTVSupport 279 | m_APIs: 10000000 280 | m_Automatic: 0 281 | - m_BuildTarget: WebGLSupport 282 | m_APIs: 0b000000 283 | m_Automatic: 0 284 | m_BuildTargetVRSettings: 285 | - m_BuildTarget: Standalone 286 | m_Enabled: 0 287 | m_Devices: 288 | - Oculus 289 | - OpenVR 290 | m_BuildTargetEnableVuforiaSettings: [] 291 | openGLRequireES31: 0 292 | openGLRequireES31AEP: 0 293 | m_TemplateCustomTags: {} 294 | mobileMTRendering: 295 | Android: 1 296 | iPhone: 1 297 | tvOS: 1 298 | m_BuildTargetGroupLightmapEncodingQuality: [] 299 | playModeTestRunnerEnabled: 0 300 | runPlayModeTestAsEditModeTest: 0 301 | actionOnDotNetUnhandledException: 1 302 | enableInternalProfiler: 0 303 | logObjCUncaughtExceptions: 1 304 | enableCrashReportAPI: 0 305 | cameraUsageDescription: 306 | locationUsageDescription: 307 | microphoneUsageDescription: 308 | switchNetLibKey: 309 | switchSocketMemoryPoolSize: 6144 310 | switchSocketAllocatorPoolSize: 128 311 | switchSocketConcurrencyLimit: 14 312 | switchScreenResolutionBehavior: 2 313 | switchUseCPUProfiler: 0 314 | switchApplicationID: 0x01004b9000490000 315 | switchNSODependencies: 316 | switchTitleNames_0: 317 | switchTitleNames_1: 318 | switchTitleNames_2: 319 | switchTitleNames_3: 320 | switchTitleNames_4: 321 | switchTitleNames_5: 322 | switchTitleNames_6: 323 | switchTitleNames_7: 324 | switchTitleNames_8: 325 | switchTitleNames_9: 326 | switchTitleNames_10: 327 | switchTitleNames_11: 328 | switchTitleNames_12: 329 | switchTitleNames_13: 330 | switchTitleNames_14: 331 | switchPublisherNames_0: 332 | switchPublisherNames_1: 333 | switchPublisherNames_2: 334 | switchPublisherNames_3: 335 | switchPublisherNames_4: 336 | switchPublisherNames_5: 337 | switchPublisherNames_6: 338 | switchPublisherNames_7: 339 | switchPublisherNames_8: 340 | switchPublisherNames_9: 341 | switchPublisherNames_10: 342 | switchPublisherNames_11: 343 | switchPublisherNames_12: 344 | switchPublisherNames_13: 345 | switchPublisherNames_14: 346 | switchIcons_0: {fileID: 0} 347 | switchIcons_1: {fileID: 0} 348 | switchIcons_2: {fileID: 0} 349 | switchIcons_3: {fileID: 0} 350 | switchIcons_4: {fileID: 0} 351 | switchIcons_5: {fileID: 0} 352 | switchIcons_6: {fileID: 0} 353 | switchIcons_7: {fileID: 0} 354 | switchIcons_8: {fileID: 0} 355 | switchIcons_9: {fileID: 0} 356 | switchIcons_10: {fileID: 0} 357 | switchIcons_11: {fileID: 0} 358 | switchIcons_12: {fileID: 0} 359 | switchIcons_13: {fileID: 0} 360 | switchIcons_14: {fileID: 0} 361 | switchSmallIcons_0: {fileID: 0} 362 | switchSmallIcons_1: {fileID: 0} 363 | switchSmallIcons_2: {fileID: 0} 364 | switchSmallIcons_3: {fileID: 0} 365 | switchSmallIcons_4: {fileID: 0} 366 | switchSmallIcons_5: {fileID: 0} 367 | switchSmallIcons_6: {fileID: 0} 368 | switchSmallIcons_7: {fileID: 0} 369 | switchSmallIcons_8: {fileID: 0} 370 | switchSmallIcons_9: {fileID: 0} 371 | switchSmallIcons_10: {fileID: 0} 372 | switchSmallIcons_11: {fileID: 0} 373 | switchSmallIcons_12: {fileID: 0} 374 | switchSmallIcons_13: {fileID: 0} 375 | switchSmallIcons_14: {fileID: 0} 376 | switchManualHTML: 377 | switchAccessibleURLs: 378 | switchLegalInformation: 379 | switchMainThreadStackSize: 1048576 380 | switchPresenceGroupId: 381 | switchLogoHandling: 0 382 | switchReleaseVersion: 0 383 | switchDisplayVersion: 1.0.0 384 | switchStartupUserAccount: 0 385 | switchTouchScreenUsage: 0 386 | switchSupportedLanguagesMask: 0 387 | switchLogoType: 0 388 | switchApplicationErrorCodeCategory: 389 | switchUserAccountSaveDataSize: 0 390 | switchUserAccountSaveDataJournalSize: 0 391 | switchApplicationAttribute: 0 392 | switchCardSpecSize: -1 393 | switchCardSpecClock: -1 394 | switchRatingsMask: 0 395 | switchRatingsInt_0: 0 396 | switchRatingsInt_1: 0 397 | switchRatingsInt_2: 0 398 | switchRatingsInt_3: 0 399 | switchRatingsInt_4: 0 400 | switchRatingsInt_5: 0 401 | switchRatingsInt_6: 0 402 | switchRatingsInt_7: 0 403 | switchRatingsInt_8: 0 404 | switchRatingsInt_9: 0 405 | switchRatingsInt_10: 0 406 | switchRatingsInt_11: 0 407 | switchLocalCommunicationIds_0: 408 | switchLocalCommunicationIds_1: 409 | switchLocalCommunicationIds_2: 410 | switchLocalCommunicationIds_3: 411 | switchLocalCommunicationIds_4: 412 | switchLocalCommunicationIds_5: 413 | switchLocalCommunicationIds_6: 414 | switchLocalCommunicationIds_7: 415 | switchParentalControl: 0 416 | switchAllowsScreenshot: 1 417 | switchAllowsVideoCapturing: 1 418 | switchAllowsRuntimeAddOnContentInstall: 0 419 | switchDataLossConfirmation: 0 420 | switchSupportedNpadStyles: 3 421 | switchSocketConfigEnabled: 0 422 | switchTcpInitialSendBufferSize: 32 423 | switchTcpInitialReceiveBufferSize: 64 424 | switchTcpAutoSendBufferSizeMax: 256 425 | switchTcpAutoReceiveBufferSizeMax: 256 426 | switchUdpSendBufferSize: 9 427 | switchUdpReceiveBufferSize: 42 428 | switchSocketBufferEfficiency: 4 429 | switchSocketInitializeEnabled: 1 430 | switchNetworkInterfaceManagerInitializeEnabled: 1 431 | switchPlayerConnectionEnabled: 1 432 | ps4NPAgeRating: 12 433 | ps4NPTitleSecret: 434 | ps4NPTrophyPackPath: 435 | ps4ParentalLevel: 11 436 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 437 | ps4Category: 0 438 | ps4MasterVersion: 01.00 439 | ps4AppVersion: 01.00 440 | ps4AppType: 0 441 | ps4ParamSfxPath: 442 | ps4VideoOutPixelFormat: 0 443 | ps4VideoOutInitialWidth: 1920 444 | ps4VideoOutBaseModeInitialWidth: 1920 445 | ps4VideoOutReprojectionRate: 60 446 | ps4PronunciationXMLPath: 447 | ps4PronunciationSIGPath: 448 | ps4BackgroundImagePath: 449 | ps4StartupImagePath: 450 | ps4StartupImagesFolder: 451 | ps4IconImagesFolder: 452 | ps4SaveDataImagePath: 453 | ps4SdkOverride: 454 | ps4BGMPath: 455 | ps4ShareFilePath: 456 | ps4ShareOverlayImagePath: 457 | ps4PrivacyGuardImagePath: 458 | ps4NPtitleDatPath: 459 | ps4RemotePlayKeyAssignment: -1 460 | ps4RemotePlayKeyMappingDir: 461 | ps4PlayTogetherPlayerCount: 0 462 | ps4EnterButtonAssignment: 1 463 | ps4ApplicationParam1: 0 464 | ps4ApplicationParam2: 0 465 | ps4ApplicationParam3: 0 466 | ps4ApplicationParam4: 0 467 | ps4DownloadDataSize: 0 468 | ps4GarlicHeapSize: 2048 469 | ps4ProGarlicHeapSize: 2560 470 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 471 | ps4pnSessions: 1 472 | ps4pnPresence: 1 473 | ps4pnFriends: 1 474 | ps4pnGameCustomData: 1 475 | playerPrefsSupport: 0 476 | enableApplicationExit: 0 477 | restrictedAudioUsageRights: 0 478 | ps4UseResolutionFallback: 0 479 | ps4ReprojectionSupport: 0 480 | ps4UseAudio3dBackend: 0 481 | ps4SocialScreenEnabled: 0 482 | ps4ScriptOptimizationLevel: 0 483 | ps4Audio3dVirtualSpeakerCount: 14 484 | ps4attribCpuUsage: 0 485 | ps4PatchPkgPath: 486 | ps4PatchLatestPkgPath: 487 | ps4PatchChangeinfoPath: 488 | ps4PatchDayOne: 0 489 | ps4attribUserManagement: 0 490 | ps4attribMoveSupport: 0 491 | ps4attrib3DSupport: 0 492 | ps4attribShareSupport: 0 493 | ps4attribExclusiveVR: 0 494 | ps4disableAutoHideSplash: 0 495 | ps4videoRecordingFeaturesUsed: 0 496 | ps4contentSearchFeaturesUsed: 0 497 | ps4attribEyeToEyeDistanceSettingVR: 0 498 | ps4IncludedModules: [] 499 | monoEnv: 500 | psp2Splashimage: {fileID: 0} 501 | psp2NPTrophyPackPath: 502 | psp2NPSupportGBMorGJP: 0 503 | psp2NPAgeRating: 12 504 | psp2NPTitleDatPath: 505 | psp2NPCommsID: 506 | psp2NPCommunicationsID: 507 | psp2NPCommsPassphrase: 508 | psp2NPCommsSig: 509 | psp2ParamSfxPath: 510 | psp2ManualPath: 511 | psp2LiveAreaGatePath: 512 | psp2LiveAreaBackroundPath: 513 | psp2LiveAreaPath: 514 | psp2LiveAreaTrialPath: 515 | psp2PatchChangeInfoPath: 516 | psp2PatchOriginalPackage: 517 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 518 | psp2KeystoneFile: 519 | psp2MemoryExpansionMode: 0 520 | psp2DRMType: 0 521 | psp2StorageType: 0 522 | psp2MediaCapacity: 0 523 | psp2DLCConfigPath: 524 | psp2ThumbnailPath: 525 | psp2BackgroundPath: 526 | psp2SoundPath: 527 | psp2TrophyCommId: 528 | psp2TrophyPackagePath: 529 | psp2PackagedResourcesPath: 530 | psp2SaveDataQuota: 10240 531 | psp2ParentalLevel: 1 532 | psp2ShortTitle: Not Set 533 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 534 | psp2Category: 0 535 | psp2MasterVersion: 01.00 536 | psp2AppVersion: 01.00 537 | psp2TVBootMode: 0 538 | psp2EnterButtonAssignment: 2 539 | psp2TVDisableEmu: 0 540 | psp2AllowTwitterDialog: 1 541 | psp2Upgradable: 0 542 | psp2HealthWarning: 0 543 | psp2UseLibLocation: 0 544 | psp2InfoBarOnStartup: 0 545 | psp2InfoBarColor: 0 546 | psp2ScriptOptimizationLevel: 0 547 | splashScreenBackgroundSourceLandscape: {fileID: 0} 548 | splashScreenBackgroundSourcePortrait: {fileID: 0} 549 | spritePackerPolicy: 550 | webGLMemorySize: 256 551 | webGLExceptionSupport: 1 552 | webGLNameFilesAsHashes: 0 553 | webGLDataCaching: 0 554 | webGLDebugSymbols: 0 555 | webGLEmscriptenArgs: 556 | webGLModulesDirectory: 557 | webGLTemplate: APPLICATION:Default 558 | webGLAnalyzeBuildSize: 0 559 | webGLUseEmbeddedResources: 0 560 | webGLCompressionFormat: 1 561 | webGLLinkerTarget: 0 562 | scriptingDefineSymbols: 563 | 1: UNITY_POST_PROCESSING_STACK_V2 564 | 4: UNITY_POST_PROCESSING_STACK_V2 565 | 7: UNITY_POST_PROCESSING_STACK_V2 566 | 13: UNITY_POST_PROCESSING_STACK_V2 567 | 17: UNITY_POST_PROCESSING_STACK_V2 568 | 18: UNITY_POST_PROCESSING_STACK_V2 569 | 19: UNITY_POST_PROCESSING_STACK_V2 570 | 21: UNITY_POST_PROCESSING_STACK_V2 571 | 23: UNITY_POST_PROCESSING_STACK_V2 572 | 24: UNITY_POST_PROCESSING_STACK_V2 573 | 25: UNITY_POST_PROCESSING_STACK_V2 574 | 26: UNITY_POST_PROCESSING_STACK_V2 575 | 27: UNITY_POST_PROCESSING_STACK_V2 576 | platformArchitecture: {} 577 | scriptingBackend: {} 578 | il2cppCompilerConfiguration: {} 579 | incrementalIl2cppBuild: {} 580 | allowUnsafeCode: 0 581 | additionalIl2CppArgs: 582 | scriptingRuntimeVersion: 0 583 | apiCompatibilityLevelPerPlatform: {} 584 | m_RenderingPath: 1 585 | m_MobileRenderingPath: 1 586 | metroPackageName: Template_3D 587 | metroPackageVersion: 588 | metroCertificatePath: 589 | metroCertificatePassword: 590 | metroCertificateSubject: 591 | metroCertificateIssuer: 592 | metroCertificateNotAfter: 0000000000000000 593 | metroApplicationDescription: Template_3D 594 | wsaImages: {} 595 | metroTileShortName: 596 | metroCommandLineArgsFile: 597 | metroTileShowName: 0 598 | metroMediumTileShowName: 0 599 | metroLargeTileShowName: 0 600 | metroWideTileShowName: 0 601 | metroDefaultTileSize: 1 602 | metroTileForegroundText: 2 603 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 604 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 605 | a: 1} 606 | metroSplashScreenUseBackgroundColor: 0 607 | platformCapabilities: {} 608 | metroFTAName: 609 | metroFTAFileTypes: [] 610 | metroProtocolName: 611 | metroCompilationOverrides: 1 612 | tizenProductDescription: 613 | tizenProductURL: 614 | tizenSigningProfileName: 615 | tizenGPSPermissions: 0 616 | tizenMicrophonePermissions: 0 617 | tizenDeploymentTarget: 618 | tizenDeploymentTargetType: -1 619 | tizenMinOSVersion: 1 620 | n3dsUseExtSaveData: 0 621 | n3dsCompressStaticMem: 1 622 | n3dsExtSaveDataNumber: 0x12345 623 | n3dsStackSize: 131072 624 | n3dsTargetPlatform: 2 625 | n3dsRegion: 7 626 | n3dsMediaSize: 0 627 | n3dsLogoStyle: 3 628 | n3dsTitle: GameName 629 | n3dsProductCode: 630 | n3dsApplicationId: 0xFF3FF 631 | XboxOneProductId: 632 | XboxOneUpdateKey: 633 | XboxOneSandboxId: 634 | XboxOneContentId: 635 | XboxOneTitleId: 636 | XboxOneSCId: 637 | XboxOneGameOsOverridePath: 638 | XboxOnePackagingOverridePath: 639 | XboxOneAppManifestOverridePath: 640 | XboxOnePackageEncryption: 0 641 | XboxOnePackageUpdateGranularity: 2 642 | XboxOneDescription: 643 | XboxOneLanguage: 644 | - enus 645 | XboxOneCapability: [] 646 | XboxOneGameRating: {} 647 | XboxOneIsContentPackage: 0 648 | XboxOneEnableGPUVariability: 0 649 | XboxOneSockets: {} 650 | XboxOneSplashScreen: {fileID: 0} 651 | XboxOneAllowedProductIds: [] 652 | XboxOnePersistentLocalStorageSize: 0 653 | XboxOneXTitleMemory: 8 654 | xboxOneScriptCompiler: 0 655 | vrEditorSettings: 656 | daydream: 657 | daydreamIconForeground: {fileID: 0} 658 | daydreamIconBackground: {fileID: 0} 659 | cloudServicesEnabled: 660 | UNet: 1 661 | facebookSdkVersion: 7.9.4 662 | apiCompatibilityLevel: 2 663 | cloudProjectId: 664 | projectName: Template_3D 665 | organizationId: 666 | cloudEnabled: 0 667 | enableNativePlatformBackendsForNewInputSystem: 0 668 | disableOldInputManagerSupport: 0 669 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.1.0b13 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 4 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 2 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 40 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 1 136 | antiAliasing: 4 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 1 164 | antiAliasing: 4 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSP2: 2 183 | Standalone: 5 184 | Tizen: 2 185 | WebGL: 3 186 | WiiU: 5 187 | Windows Store Apps: 5 188 | XboxOne: 5 189 | iPhone: 2 190 | tvOS: 2 191 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - PostProcessing 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.0167 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 1 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity Procedural spaceship generator 2 | 3 | This is a port of a spaceship generator originally written as a blender plugin authored by [Michael Davies](https://github.com/a1studmuffin) which can be found [here](https://github.com/a1studmuffin/SpaceshipGenerator) 4 | 5 | ![](Images/scr1.png) 6 | 7 | ## Feature list 8 | 9 | - [x] Main spaceship segments extrusion 10 | - [x] Asymmetry segments 11 | - [x] Face details 12 | - [x] exhaust 13 | - [x] grid 14 | - [x] surface antenna 15 | - [x] weapons 16 | - [x] sphere to face 17 | - [x] disc to face 18 | - [x] cylinders to face 19 | - [ ] horizontal symmetry 20 | - [ ] vertical symmetry 21 | - [ ] bevels 22 | - [ ] materials 23 | 24 | This project is licensed under [MIT license](LICENSE.md). --------------------------------------------------------------------------------