void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<Actors.Player>(); startRotation = new Quaternion(0, 0, 0, 1); endRotation = new Quaternion(0, 0, 0, 1); startRotation.SetEulerAngles(0, 0, 0); endRotation.SetEulerAngles(0, 1, 0); }
void Start () { thisHandlePivot = this.transform.parent.gameObject; eulerEnd = (negative) ? -3.14f : 3.14f; start = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); stop = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); // lastKnown = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); start.SetEulerAngles(0.0f, 0.0f, 0.0f); stop.SetEulerAngles(0.0f, 0.0f, eulerEnd); }
// Use this for initialization void Start() { // Angle0 = new Vector3(0,0,0); // Angle90 = new Vector3(0.5f * Mathf.PI,0.0f,0.0f); // Angle180 = new Vector3(180,0,0); // Angle270 = new Vector3(270,0,0); startingAngle = new Quaternion(0.0f,0.0f,0.0f,1.0f); targetAngle = new Quaternion(0.0f,0.0f,0.0f,1.0f); startingAngle.SetEulerAngles(0.0f,0.0f,0.0f); targetAngle.SetEulerAngles(0.5f * Mathf.PI,0.0f,0.0f); }
public void AsyncGenerateData() { if (queuedPoints == null) { queuedPoints = new List<Vector3>(); Quaternion quat = new Quaternion(); int rotationCounter = 0; float rotationStepSize = 10; for (float j = 2; j < 30; j *= 1.02f) { for (float f = 0 + rotationCounter; f < 360 + rotationCounter; f += rotationStepSize) { quat.SetEulerAngles(new Vector3(0, f, 0)); AsyncQueueCount++; queuedPoints.Add(origin + (quat * Vector3.forward * j)); //DebugOutput.Shout("BASDASD"); } rotationStepSize *= 0.983f; //rotationCounter++; } } TerrainGenerator tgen = new TerrainGenerator(Mathf.Pow(2, worldSize)); int queuedPos = AsyncQueuePlacement; int stepsize = 100; while ((queuedPos < (AsyncQueuePlacement + stepsize)) && queuedPos < queuedPoints.Count) { pendingData.Add(new SurveyDataPoint(queuedPoints[queuedPos], tgen.GeneratePointValueDouble(queuedPoints[queuedPos]))); queuedPos++; } AsyncQueuePlacement += stepsize; }
public static void findFacingProjectionPlane(Entity e, GameObject go) { Vector3 position = new Vector3(0.0f, 0.0f, 0.0f); Quaternion rotation = new Quaternion(); rotation.SetEulerAngles(0.0f, 0.0f, 0.0f); Vector3 scale = new Vector3(1.0f, 1.0f, 1.0f); bool facing = false; Vector3[] rect = new Vector3[4]; rect[2] = new Vector3(-100.0f, -100.0f, 0.0f); rect[3] = new Vector3(100.0f, 100.0f, 0.0f); rect[1] = new Vector3(100.0f, -100.0f, 0.0f); rect[0] = new Vector3(-100.0f, 100.0f, 0.0f); float x = e.boundingBoxD * 0.5f; float y = e.boundingBoxH * 0.5f; float z = e.boundingBoxW * 0.5f; rect[2] = new Vector3(-x, -y, z); rect[3] = new Vector3(x, y, z); rect[1] = new Vector3(x, -y, z); rect[0] = new Vector3(-x, y, z); Debug.Log("WH"); facing = isFacing(rect[0], rect[1], rect[2]); if (!facing) { x = e.boundingBoxD * 0.5f; y = e.boundingBoxW * 0.5f; z = e.boundingBoxH * 0.5f; rect[2] = new Vector3(-x, z, -y); rect[3] = new Vector3(x, z, y); rect[1] = new Vector3(x, z, -y); rect[0] = new Vector3(-x, z, y); Debug.Log("WD"); facing = isFacing(rect[0], rect[1], rect[2]); if (!facing) { x = e.boundingBoxH * 0.5f; y = e.boundingBoxW * 0.5f; z = e.boundingBoxD * 0.5f; //x = e.boundingBoxH * 0.5f; //y = e.boundingBoxD * 0.5f; //z = e.boundingBoxW * 0.5f; rect[2] = new Vector3(z, -x, -y); rect[3] = new Vector3(z, x, y); rect[1] = new Vector3(z, x, -y); rect[0] = new Vector3(z, -x, y); Debug.Log("HD"); facing = isFacing(rect[0], rect[1], rect[2]); if (!facing) { Debug.Log("s***e"); } } } go.transform.position = position; go.transform.rotation = rotation; go.transform.localScale = scale; Mesh mesh = go.GetComponent<MeshFilter>().mesh; Vector3[] vertices = new Vector3[4]; Debug.Log(mesh.vertices[0]); Debug.Log(mesh.vertices[1]); Debug.Log(mesh.vertices[2]); Debug.Log(mesh.vertices[3]); for (int i = 0; i < vertices.Length; i++) { vertices[i] = (e.center + rect[i]) * PersistantSettings.Instance.Scale; Debug.Log(e.center + rect[i]); } mesh.vertices = vertices; mesh.RecalculateBounds(); }
//initialize with bounding box or rect extents //should be a singleton so that it can be accessed by the proxy reps when querying the drawing state //update when boundingbox of dataset changes public static void findBiggestProjectionPlane(Entity e, GameObject go) { Vector3 position = new Vector3(0.0f, 0.0f, 0.0f); Quaternion rotation = new Quaternion(); rotation.SetEulerAngles(0.0f, 0.0f, 0.0f); Vector3 scale = new Vector3(1.0f, 1.0f, 1.0f); Vector3[] rect = new Vector3[4]; rect[0] = new Vector3(-100.0f, -100.0f, 0.0f); rect[1] = new Vector3(100.0f, 100.0f, 0.0f); rect[2] = new Vector3(100.0f, -100.0f, 0.0f); rect[3] = new Vector3(-100.0f, 100.0f, 0.0f); if (e.boundingBoxW >= e.boundingBoxD && e.boundingBoxH >= e.boundingBoxD) { /*position += new Vector3(0.0f, 0.0f, e.boundingBoxD * 0.5f); rotation.SetEulerAngles(0.0f, 0.0f, 0.0f); scale = new Vector3(e.boundingBoxW, e.boundingBoxH, e.boundingBoxD);*/ float x = e.boundingBoxD * 0.5f; float y = e.boundingBoxH * 0.5f; float z = e.boundingBoxW * 0.5f; rect[0] = new Vector3(-x, -y, z); rect[1] = new Vector3(x, y, z); rect[2] = new Vector3(x, -y, z); rect[3] = new Vector3(-x, y, z); Debug.Log("WH"); } else if (e.boundingBoxW >= e.boundingBoxH && e.boundingBoxD >= e.boundingBoxH) { /*position += new Vector3(0.0f, e.boundingBoxH * 0.5f, 0.0f); rotation.SetEulerAngles(90.0f, 90.0f, 0.0f); scale = new Vector3(e.boundingBoxW, e.boundingBoxD, e.boundingBoxH);*/ float x = e.boundingBoxD * 0.5f; float y = e.boundingBoxW * 0.5f; float z = e.boundingBoxH * 0.5f; rect[0] = new Vector3(-x, z, -y); rect[1] = new Vector3(x, z, y); rect[2] = new Vector3(x, z, -y); rect[3] = new Vector3(-x, z, y); Debug.Log("WD"); } else if (e.boundingBoxH >= e.boundingBoxW && e.boundingBoxD >= e.boundingBoxW) { /*position += new Vector3(e.boundingBoxW * 0.5f, 0.0f, 0.0f); rotation.SetEulerAngles(0.0f, 90.0f, 0.0f); scale = new Vector3(e.boundingBoxH, e.boundingBoxD, e.boundingBoxW);*/ float x = e.boundingBoxH * 0.5f; float y = e.boundingBoxW * 0.5f; float z = e.boundingBoxD * 0.5f; rect[0] = new Vector3(z, -x, -y); rect[1] = new Vector3(z, x, y); rect[2] = new Vector3(z, x, -y); rect[3] = new Vector3(z, -x, y); Debug.Log("HD"); } go.transform.position = position; go.transform.rotation = rotation; go.transform.localScale = scale; Mesh mesh = go.GetComponent<MeshFilter>().mesh; Vector3[] vertices = new Vector3[4]; Debug.Log(mesh.vertices[0]); Debug.Log(mesh.vertices[1]); Debug.Log(mesh.vertices[2]); Debug.Log(mesh.vertices[3]); for (int i = 0; i < vertices.Length; i++) { vertices[i] = (e.center + rect[i]) * PersistantSettings.Instance.Scale; Debug.Log(e.center + rect[i]); } mesh.vertices = vertices; mesh.RecalculateBounds(); }