void MarkerSpawn() { // Debug.Log(string.Format("[SCREEN] ray_x: {0}\n ray_y: {1}\n ray_r: {2}", // ray_x, ray_y, ray_r)); Vector2 ray_pos = m_cv.GetPos(); // Debug.LogFormat("{0}, {1}", ray_pos, m_cv.GetRad()); bool arRayBool = m_ARRaycastManager.Raycast(ray_pos, s_Hits, TrackableType.PlaneWithinPolygon); bool edgeRayBool = m_ARRaycastManager.Raycast(ray_pos + (new Vector2(m_cv.GetRad(), 0)), e_Hits, TrackableType.PlaneWithinPolygon); // Debug.Log(arRayBool); if (arRayBool) { var hit = s_Hits[0]; var edge = e_Hits[0]; float dist = Vector3.Distance(hit.pose.position, edge.pose.position); // Debug.Log(dist); // Debug.Log(spawnedObject.transform.localScale); if (spawnedObject == null) { spawnedObject = Instantiate(m_PlacedPrefab, hit.pose.position, hit.pose.rotation); spawnedObject.transform.localScale = (new Vector3(dist, dist, dist)) * 10; // Debug.Log(spawnedObject.transform.localScale); } else { spawnedObject.transform.position = hit.pose.position; spawnedObject.transform.localScale = (new Vector3(dist, dist, dist)) * 10; // Debug.Log(spawnedObject.transform.localScale); } } }
void MarkerSpawn() { Vector2 ray_pos = m_cv.GetPos(); bool arRayBool = m_ARRaycastManager.Raycast(ray_pos, s_Hits, TrackableType.PlaneWithinPolygon); bool edgeRayBool = m_ARRaycastManager.Raycast(ray_pos + (new Vector2(m_cv.GetRad(), 0)), e_Hits, TrackableType.PlaneWithinPolygon); if (arRayBool) { var hit = s_Hits[0]; face = hit; var edge = e_Hits[0]; float dist = Vector3.Distance(hit.pose.position, edge.pose.position); if (spawnedObject == null) { spawnedObject = Instantiate(m_PlacedPrefab, hit.pose.position, hit.pose.rotation); spawnedObject.transform.localScale = (new Vector3(dist, dist, dist)) * 10; } else { spawnedObject.transform.position = hit.pose.position; spawnedObject.transform.localScale = (new Vector3(dist, dist, dist)) * 10; } } }