Skip to content

Commit

Permalink
Fix visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
msz-rai committed Nov 15, 2023
1 parent 5cd6a58 commit 067f263
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Assets/RGLUnityPlugin/Scripts/PointCloudVisualization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public enum PointShape
private Mesh mesh;

private Vector3[] onlyHits = Array.Empty<Vector3>();
private int pointCount = 0;
private int[] indices = Array.Empty<int>();

private LidarSensor lidarSensor;
Expand Down Expand Up @@ -142,7 +143,7 @@ public void SetPoints(Vector3[] points)

mesh.Clear();
mesh.vertices = points;
mesh.SetIndices(indices, 0, points.Length, MeshTopology.Points, 0);
mesh.SetIndices(indices, 0, pointCount, MeshTopology.Points, 0);

if (autoComputeColoringHeights)
{
Expand All @@ -165,7 +166,7 @@ public void Update()

private void OnNewLidarData()
{
rglSubgraphVisualizationOutput.GetResultData<Vector3>(ref onlyHits);
pointCount = rglSubgraphVisualizationOutput.GetResultData<Vector3>(ref onlyHits);
SetPoints(onlyHits);
}
}
Expand Down

0 comments on commit 067f263

Please sign in to comment.