Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*You can get full source from here
https://github.com/google-ar/arcore-unity-sdk/releases/download/v1.2.0/arcore-unity-sdk-v1.2.0.unitypackage
*/
private const int k_MaxPointCount = 61440;
private Mesh m_Mesh;
private Vector3[] m_Points = new Vector3[k_MaxPointCount];
private int[] indices = new int[k_MaxPointCount];//add by Limes
public void Start(){
m_Mesh = GetComponent<MeshFilter>().mesh;
m_Mesh.Clear();
}
public void Update(){
// Fill in the data to draw the point cloud.
if (Frame.PointCloud.IsUpdatedThisFrame){
// Copy the point cloud points for mesh verticies.
for (int i = 0; i < Frame.PointCloud.PointCount; i++){
m_Points[i] = Frame.PointCloud.GetPoint(i);
}
// Update the mesh indicies array.
// int[] indices = new int[Frame.PointCloud.PointCount]; //deleted from Limes
for (int i = 0; i < Frame.PointCloud.PointCount; i++){
indices[i] = i;
}
m_Mesh.Clear();
m_Mesh.vertices = m_Points;
m_Mesh.SetIndices(indices, MeshTopology.Points, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment