This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create a mesh of triangles in a 2D grid | |
| // Attach this script to a GameObject that already has a MeshFilter - it will use that MeshFilter, replacing its existing mesh data | |
| // Creates a numCols x numRows grid of vertices in the X/Y plane. Then for each square cell in the grid it creates 2 triangles | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class grid : MonoBehaviour { | |
| public int numRows=10, numCols=10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Creates a Unity Mesh that contains a wavy 2D surface, then animates that surface. | |
| // Based on grid.cs (except now in the X/Z plane), gives each vertex a different height using Sin & Cos. | |
| // Should be attached to a GameObject that already has a MeshFilter component. | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class waves : MonoBehaviour { | |
| public int numRows=10, numCols=10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Creating Mesh data in Unity | |
| // This script should be attached to a GameObject that has a MeshFilter and MeshRenderer. | |
| // The script will replace the MeshFilter's geometry by 2 triangles with texture coordinates. | |
| // The vertex coords & tex coords are public variables so they can be manipulated from the Unity inspector. | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class triangles3 : MonoBehaviour { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class fractalland : MonoBehaviour { | |
| Vector3[][] newArray(int size) | |
| { | |
| Vector3[][] v = new Vector3[size][]; | |
| for (int i=0; i < size; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class noiseland : MonoBehaviour { | |
| public int numRows=10, numCols=10; | |
| public float minX=-1, maxX=1, minY=-1, maxY=1; | |
| float height(float x, float y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class noisetex : MonoBehaviour { | |
| public int width=256; | |
| public int height=256; | |
| private Texture2D tex; | |
| private Color32[] colors; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class noiseland2 : MonoBehaviour { | |
| public int numRows=10, numCols=10; | |
| public float minX=-1, maxX=1, minY=-1, maxY=1; | |
| public int tex_width=256; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Display the state of a few example Unity Input values | |
| // This script should be attached to a text object. | |
| // It uses the "Jump" and "Cancel" buttons to switch between very slow framerate & 60 fps, so that the behavior of GetButtonDown & GetButtonUp can be seen. | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.UI; | |
| public class showInput : MonoBehaviour | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class LatLonSphere : MonoBehaviour | |
| { | |
| public int latRes=20, lonRes=40; | |
| void Start() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Example of reading earthquake data from the USGS data feed. | |
| Starting point for visualization project. | |
| This script requests GEOJson formatted data, then parses it and prints some of the information. | |
| It requires the JSONObject class for Unity, which can be downloaded from https://github.com/mtschoen/JSONObject | |
| */ | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.Networking; |