There is an error said “Library/PackageCache/com.unity.xr.arkit@2.1.2/Runtime/ImageTracking/ARKitImageTrackingProvider.cs(25,53): error CS1715: ‘ARKitImageTrackingSubsystem.Provider.imageLibrary’: type must be ‘RuntimeReferenceImageLibrary’ to match overridden member ‘XRImageTrackingSubsystem.IProvider.imageLibrary'”
I signed up placenote.com and got the API address for the navigation. And also found the arrow data from navigation kit. So I connected the location data into navigation.
Yet the problem is that placenote spatial information is built for IOS application. As I am developing application for Magic Leap, the application should connected with Lumin application. I’m still looking for the solution.
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DataPlotter_1215 : MonoBehaviour
{
Renderer rend;
float duration = 0.1f;
private int k;
private float colorChangeTime = 1;
private float colorChangeTimer = 0;
GameObject cub;
List<GameObject> cubs;
// Name of the input file, no extension
public string inputfile_origin;
public string inputfile_moved;
// List for holding data from CSV reader
private List<Dictionary<string, object>> o_pointList;
private List<Dictionary<string, object>> m_pointList;
// indices for columns to be assigned
public int oColumnx;
public int oColumny;
public int oColumnz;
public int mColumnx;
public int mColumny;
public int mColumnz;
// Full column names
private string o_xName;
private string o_yName;
private string o_zName;
private string m_xName;
private string m_yName;
private string m_zName;
// z value
private float ox;
private float oy;
private float oz;
private float mx;
private float my;
private float mz;
// The prefab for the data point to be instantiated
public GameObject originprefab;
public GameObject movedprefab;
// color value
int a = 0;
int b = 0;
int c = 0;
// Use this for initialization
void Start()
{
SetLocation();
}
private void SetLocation()
{
// Set pointlist to results of function Reader with argument inputfile
o_pointList = CSVReader.Read(inputfile_origin);
m_pointList = CSVReader.Read(inputfile_moved);
//Declare list of string, fill with keys (column names)
List<string> o_columnList = new List<string>(o_pointList[1].Keys);
List<string> m_columnList = new List<string>(m_pointList[1].Keys);
//assign column name from columnlist to name variables
o_xName = o_columnList[oColumnx];
o_yName = o_columnList[oColumny];
o_zName = o_columnList[oColumnz];
m_zName = m_columnList[mColumnz];
GameObject cub;
//Loop through Pointlist
for (var i = 0; i < o_pointList.Count; i++)
{
// Get value in poinList at ith "row", in "column" Name
ox = System.Convert.ToSingle(o_pointList[i][o_xName]);
oy = System.Convert.ToSingle(o_pointList[i][o_yName]);
oz = System.Convert.ToSingle(o_pointList[i][o_zName]);
mz = System.Convert.ToSingle(m_pointList[i][m_zName]);
//color
ChangeAbc();
Color differentColor = new Color(a, b, c);
//instantiate the prefab with coordinates defined above
cub = Instantiate(originprefab, new Vector3(ox, oy, oz), Quaternion.identity);
cub.transform.position = new Vector3(ox, oy + (oy), oz);
cub.transform.localScale = new Vector3(1, 2 * oy, 1);
cub.GetComponent<Renderer>().material.color = differentColor;
}
}
private void ChangeAbc()
{
for (k = 0; k < o_pointList.Count; k++)
{
float colorValue = System.Convert.ToSingle(o_pointList[k][o_yName]);
float minValue = Mathf.Min(oy);
Debug.Log(minValue);
float maxValue = Mathf.Max(oy);
Debug.Log(maxValue);
float length = (maxValue - minValue) / 5;
Debug.Log(length);
a = 0;
b = 1;
c = 1;
//float lerp = Mathf.PingPong(Time.time, duration) / duration; //Color.Lerp(color2, color2, lerp);
if (colorValue > (minValue + 4 * length))
{
float greenValue = 125 - ((colorValue - (minValue + 4 * length)) / length) * 125;
float newGreen = greenValue / 255;
a = 1;
b = (int)newGreen;
c = 0;
}
if (colorValue > (minValue + 3 * length))
{
float greenValue2 = 255 - ((colorValue - (minValue + 3 * length)) / length) * 125;
float newGreen2 = greenValue2 / 255;
a = 1;
b = (int)newGreen2;
c = 0;
}
if (colorValue > (minValue + 2 * length))
{
float redValue1 = ((colorValue - (minValue + 2 * length)) / length) * 255;
float newRed1 = redValue1 / 255;
a = (int)newRed1;
b = 1;
c = 0;
}
if (colorValue > (minValue + length))
{
float blueValue1 = 255 - (colorValue - (minValue + length)) / length * 125;
float newBlue1 = blueValue1 / 255;
a = 0;
b = 1;
c = (int)newBlue1;
}
if ((minValue + length) > colorValue)
{
a = 0;
b = 1;
c = 1;
}
}
}
}
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DataPlotter : MonoBehaviour
{
Renderer rend;
float duration = 0.1f;
private int k;
private float colorChangeTime = 1;
private float colorChangeTimer = 0;
// Name of the input file, no extension
public string inputfile_origin;
public string inputfile_moved;
// List for holding data from CSV reader
private List<Dictionary<string, object>> o_pointList;
private List<Dictionary<string, object>> m_pointList;
// indices for columns to be assigned
public int oColumnx;
public int oColumny;
public int oColumnz;
public int mColumnx;
public int mColumny;
public int mColumnz;
// Full column names
private string o_xName;
private string o_yName;
private string o_zName;
private string m_xName;
private string m_yName;
private string m_zName;
// z value
private float ox;
private float oy;
private float oz;
private float mx;
private float my;
private float mz;
// The prefab for the data point to be instantiated
public GameObject originprefab;
public GameObject movedprefab;
// Use this for initialization
void Start()
{
SetLocation();
}
private void SetLocation()
{
// Set pointlist to results of function Reader with argument inputfile
o_pointList = CSVReader.Read(inputfile_origin);
m_pointList = CSVReader.Read(inputfile_moved);
//Declare list of string, fill with keys (column names)
List<string> o_columnList = new List<string>(o_pointList[1].Keys);
List<string> m_columnList = new List<string>(m_pointList[1].Keys);
/*/print number of keys list (using .count)
Debug.Log("There are " + o_columnList.Count + "column in origin csv");
foreach (string o_key in o_columnList)
Debug.Log("Column name is " + o_key);
Debug.Log("There are " + m_columnList.Count + "column in moved csv");
foreach (string m_key in m_columnList)
Debug.Log("Column name is " + m_key);*/
//assign column name from columnlist to name variables
o_xName = o_columnList[oColumnx];
o_yName = o_columnList[oColumny];
o_zName = o_columnList[oColumnz];
m_xName = m_columnList[mColumnx];
m_yName = m_columnList[mColumny];
m_zName = m_columnList[mColumnz];
//Loop through Pointlist
for (var i = 0; i < o_pointList.Count; i++)
{
// Get value in poinList at ith "row", in "column" Name
ox = System.Convert.ToSingle(o_pointList[i][o_xName]);
oy = System.Convert.ToSingle(o_pointList[i][o_yName]);
oz = System.Convert.ToSingle(o_pointList[i][o_zName]);
//instantiate the prefab with coordinates defined above
Instantiate(originprefab, new Vector3(ox, oy, oz), Quaternion.identity);
}
for (var j = 0; j < m_pointList.Count; j++)
{
// Get value in poinList at ith "row", in "column" Name
mx = System.Convert.ToSingle(m_pointList[j][m_xName]);
my = System.Convert.ToSingle(m_pointList[j][m_yName]);
mz = System.Convert.ToSingle(m_pointList[j][m_zName]);
//instantiate the prefab with coordinates defined above
Instantiate(movedprefab, new Vector3(mx, my, mz), Quaternion.identity);
}
}
void Update()
{
colorChangeTimer += Time.deltaTime;
if (colorChangeTimer >= colorChangeTime)
{
colorChangeTimer = 0;
ChangeColor();
}
}
private void ChangeColor()
{
for (int k = 0; k < o_pointList.Count; k++)
{
float colorValue = System.Convert.ToSingle(m_pointList[k][m_zName]);
int val = (int)colorValue;
float minValue = Mathf.Min(mz);
float maxValue = Mathf.Max(mz);
float length = (maxValue - minValue) / 5;
int min = (int)minValue;
int max = (int)maxValue;
int len = (int)length;
Renderer rend = movedprefab.GetComponent<Renderer>();
if (val > (min + 4*len))
{
int greenValue = 125 - ((val - (min + 4*len)) / len) * 125;
float newGreen = greenValue / 255f;
Debug.Log(val);
Color color1 = new Color(1, newGreen, 0);
float lerp = Mathf.PingPong(Time.time, duration) / duration;
rend.sharedMaterial.color = Color.Lerp(color1, color1, lerp);
}
if (val > (min + 3*len))
{
int greenValue2 = 255 - ((val - (min + 3*len)) / len) * 125;
float newGreen2 = greenValue2 / 255f;
Debug.Log(val);
Color color2 = new Color(1, newGreen2, 0);
float lerp = Mathf.PingPong(Time.time, duration) / duration;
rend.sharedMaterial.color = Color.Lerp(color2, color2, lerp);
}
if (val > (min + 2*len))
{
int redValue1 = ((val - (min + 2 * len)) / len) * 255;
float newRed1 = redValue1 / 255f;
Color color3 = new Color(newRed1, 1, 0);
Debug.Log(val);
float lerp = Mathf.PingPong(Time.time, duration) / duration;
rend.sharedMaterial.color = Color.Lerp(color3, color3, lerp);
}
if (val > (min + len))
{
int blueValue1 = 255 - (val - (min + len)) / len * 125;
float newBlue1 = blueValue1 / 255f;
Color color4 = new Color(0, 1, newBlue1);
Debug.Log(val);
float lerp = Mathf.PingPong(Time.time, duration) / duration;
rend.sharedMaterial.color = Color.Lerp(color4, color4, lerp);
}
if ((min + len) > val)
{
Debug.Log(val);
Color color5 = new Color(0, 1, 1);
float lerp = Mathf.PingPong(Time.time, duration) / duration;
rend.sharedMaterial.color = Color.Lerp(color5, color5, lerp);
}
k++;
}
}
}