This repository has been archived on 2026-01-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
URRobot/Assets/Scripts/Common/Robot.cs
jmaniuvc 282fcfe688 main
2025-05-29 09:51:58 +09:00

45 lines
1.2 KiB
C#

using System.Collections.Generic;
using UnityEngine;
abstract public class Robot : MonoBehaviour
{
// 로봇 기본 정보
public List<Transform> jointsPosList;
public int jointCount;
public List<string> rotationDirList;
public float[] rotationValueArray;
public List<Vector3> rotationVector3List;
public GameObject[] jointUIArray;
//public GameObject[] jointUIs;
//public GameObject tcpUI;
//protected float torqueValues;
public abstract void Rotate(string[] data);
public abstract void UpdatePopupUI();
protected virtual void Start()
{
jointsPosList = new List<Transform>();
rotationDirList = new List<string>();
// 조인트, 회전 방향 매핑
Transform[] allChildren = GetComponentsInChildren<Transform>();
foreach (Transform child in allChildren)
{
if (child.tag.Equals("Joint"))
{
jointsPosList.Add(child);
rotationDirList.Add(child.name.Substring(child.name.IndexOf('(') + 1, 1));
}
}
jointCount = jointsPosList.Count;
rotationVector3List = new List<Vector3>(new Vector3[jointCount]);
rotationValueArray = new float[jointCount];
}
}