// Start is called before the first frame update void Start() { Instantiate(plane, Vector3.zero, Quaternion.identity); Instantiate(axis, Vector3.zero, Quaternion.identity); Instantiate(axis, Vector3.zero, Quaternion.Euler(0, 90, 0)); Instantiate(axis, Vector3.zero, Quaternion.Euler(0, 0, 90)); for (int i = -5; i <= 5; i++) { for (int j = -5; j <= 5; j++) { for (int k = -5; k <= 5; k++) { Instantiate(lockpoint, new Vector3(i, j, k), Quaternion.identity); } } } GameObject Origin = Instantiate(lockpoint, Vector3.zero, Quaternion.identity); Origin.transform.localScale += new Vector3(.2f, .2f, .2f); Vector3 vecA = new Vector3(1, 2, 3); Vector3 vecB = new Vector3(3, 2, 1); InstantiateVector.V(normvector, green, vecA, Vector3.zero); InstantiateVector.V(normvector, blue, vecB, Vector3.zero); vector_utils.Vadd(normvector, green, blue, purple, vecA, vecB); List <Vector3> lines = new List <Vector3>(); lines.Add(vecA); lines.Add(vecB); vector_utils.spanulate(lines, plane); }
public static void Vadd(GameObject normvector, Material color1, Material color2, Material colorR, Vector3 vec1, Vector3 vec2) { Vector3 vecR = vec1 + vec2; InstantiateVector.V(normvector, colorR, vecR, Vector3.zero); InstantiateVector.V(normvector, color1, vec1, vec2); InstantiateVector.V(normvector, color2, vec2, vec1); }
/*void IMixedRealitySpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData) * { * if (eventData.Command.Keyword == "create") * { * Vector3 pos = GetComponent<Rigidbody>().position; * InstantiateVector.V(normvector, green, pos, Vector3.zero); * } * }*/ public void OnMouseDown() { if (!hasVector) { Vector3 pos = GetComponent <Rigidbody>().position; connectedVector = InstantiateVector.V(normvector, green, pos, Vector3.zero); Debug.Log("Created normvector\n"); hasVector = true; } else { Debug.Log("Vector is already on this lockpoint\n"); } }
public void vec_mat_mul(Vector3 vec, Matrix mat) { int i, j; double temp = 0; for (i = 0; i < mat.rows; i++) { temp = 0; for (j = 0; j < mat.cols; j++) { temp += (double)vec[i] * mat[i, j]; } vec[i] = (int)temp; } InstantiateVector.V(normvector, green, vec, Vector3.zero); }