Files
HDRobotics/Assets/Scripts/View/PathLineView.cs
2025-10-30 09:31:05 +09:00

36 lines
841 B
C#
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
using UnityEngine;
// ÀÎÅÍÆäÀ̽º
public interface IPathLineView
{
void DrawPath(List<RobotData> poses); // (RobotProgram.Steps¿¡¼­ º¯È¯)
}
[RequireComponent(typeof(LineRenderer))]
public class PathLineView : MonoBehaviour, IPathLineView
{
private LineRenderer lineRenderer;
void Awake()
{
lineRenderer = GetComponent<LineRenderer>();
lineRenderer.positionCount = 0;
}
public void DrawPath(List<RobotData> poses)
{
if (poses == null || poses.Count < 2)
{
lineRenderer.positionCount = 0;
return;
}
lineRenderer.positionCount = poses.Count;
for (int i = 0; i < poses.Count; i++)
{
lineRenderer.SetPosition(i, new Vector3(poses[i].x, poses[i].y, poses[i].z));
}
}
}