public override void OnInspectorGUI() { DrawDefaultInspector(); TubeGenerator generator = (TubeGenerator)target; if (GUILayout.Button("Generate Tube from path")) { generator.GenerateTube(false); } if (GUILayout.Button("Generate Tube from file")) { generator.GenerateTube(true); } }
public override void Initialize() { GenerateCollisionObjects(); tubeGenerator = GetComponent <TubeGenerator>(); Tube tube = tubeGenerator.GenerateTube(widthScale); tubeScaler = GetComponent <TubeScaler>(); tubeScaler.TubeSegments = tube.Bones; tubeMeshUpdater = GetComponent <TubeMeshUpdater>(); tubeMeshUpdater.Initialize(tube, startConnection, endConnection); transform.rotation = startConnection.rotation; gravitationForce = gameObject.AddComponent <Gravitation>(); }
public override void SupplyMesh() { tubeGenerator = GetComponent <TubeGenerator>(); tube = tubeGenerator.GenerateTube(); mesh = tube.Mesh; skinnedMeshRenderer.sharedMesh = mesh; skinnedMeshRenderer.bones = tube.Bones; xAmount = tube.Vertex2DRepresentation.GetLength(0); yAmount = tube.Vertex2DRepresentation.GetLength(1); vertex2DRepresentation = tube.Vertex2DRepresentation; changeVector = new Vector3(); newVertexPositions = new List <Vector3>(); vertexDirections = new Vector3[xAmount]; for (int i = 0; i < mesh.vertexCount; i++) { newVertexPositions.Add(mesh.vertices[i]); } }
void Start() { middleMassPointLine = new List <PointMass>(); upperMassPointLine = new List <PointMass>(); lowerMassPointLine = new List <PointMass>(); leftMassPointLine = new List <PointMass>(); rightMassPointLine = new List <PointMass>(); constraintList = new List <Constraint>(); meshFilter = GetComponent <MeshFilter>(); mesh = meshFilter.mesh; tubeGenerator = GetComponent <TubeGenerator>(); tube = tubeGenerator.GenerateTube(); vertex2DRepresentation = tube.Vertex2DRepresentation; xAmount = tube.Vertex2DRepresentation.GetLength(0); yAmount = tube.Vertex2DRepresentation.GetLength(1); mesh = tube.Mesh; vertices = mesh.vertices; //GenerateMassPoints(); GenerateMassPointLine(); ConnectMassPoints(); meshFilter.mesh = mesh; isInitialized = true; }