AR Foundation演示项目,使用 AR Foundation 4.1.7 并围绕某些功能演示更高级功能。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

48 行
1.2 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BodyPoser : MonoBehaviour
{
[SerializeField]
Transform m_Root;
[SerializeField]
Transform m_RootParent;
List<Transform> m_Joints = new List<Transform>();
int m_JointIndex = 0;
int m_TotalJoints = 92;
void GetJoints()
{
Queue<Transform> nodes = new Queue<Transform>();
nodes.Enqueue(m_Root);
while (nodes.Count > 0)
{
Transform next = nodes.Dequeue();
for (int i = 0; i < next.childCount; ++i)
{
nodes.Enqueue(next.GetChild(i));
}
m_Joints.Add(next);
}
List<Transform> m_NewJoints = m_Joints;
m_Joints = new List<Transform>();
m_Joints.Add(m_RootParent);
for (int i = 0; i < m_NewJoints.Count; i++)
{
m_Joints.Add(m_NewJoints[i]);
}
}
public void SetJointPositionAndRotation(Vector3 pos, Quaternion rot)
{
m_Joints[m_JointIndex].SetPositionAndRotation(pos, rot);
m_JointIndex++;
}
}