public GameObject drawServerPoint(PointInformation point, int index) { Vector2 pointVector = new Vector2(point.x, point.y); Vector3 anchorposition; GameObject pointObj = null; bool matched = false; foreach (KeyValuePair <Vector2, Vector3> val in hitPointMap) { Vector2 mapPoint = val.Key; if (mapPoint.Equals(pointVector)) { matched = true; } if (matched) { Debug.Log("Found point!"); anchorposition = val.Value; Debug.Log(anchorposition.ToString()); pointObj = DisplayAnchorPoint(anchorposition, index); break; } } if (!matched) { Debug.Log("No local match found for the server point"); Debug.Log(pointVector); } return(pointObj); }
public Simulation() { m_Curls = new PointInformation[CurlsCount * StrandsCount]; for (int Index = 0, Count = CurlsCount * StrandsCount; Index < Count; ++Index) { m_Curls[Index] = new PointInformation(); } }
public void debugServerPoints(int height, int width) { Camera tempCam = mainCamera.GetComponentInChildren <Camera>(); for (int i = 0; i < Mathf.Min(4, pointClouds.Length); i++) { Vector3 testPoint = pointClouds [i]; Vector3 screenPos = tempCam.WorldToScreenPoint(testPoint); hitPointMap.Add(new Vector2(screenPos.x, screenPos.y), testPoint); reverseHitPointMap.Add(testPoint, new Vector2(screenPos.x, screenPos.y)); PointInformation fakePoint = new PointInformation(screenPos.x, screenPos.y); Debug.Log("making a fake point"); drawServerPoint(fakePoint, i); anchorSelect = false; } }
public IEnumerator requestAnchorPoint() { pollForAnchor = false; Dictionary <string, string> headers = new Dictionary <string, string> (); headers.Add("x-user-id", guid); WWW w = new WWW(address + pointPollEndpoint, empty_post_data, headers); yield return(w); if (w.error != null) { Debug.Log(w.error); } else { if (w.text.Length == 0) { pollForAnchor = true; } else { PointInformation anchorpoint = PointInformation.CreateFromJSON(w.text); selectedMultiplayARAnchor = drawServerPoint(anchorpoint, 0); // anchor selected on server! LOCK IN //anchorChosen = true; anchorSelect = true; anchor = selectedMultiplayARAnchor; setHeading = true; } } yield break; }