123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CustomRoleController : MonoBehaviour
- {
- private Animator ani;
- private void Start()
- {
- ani = GetComponent<Animator>();
- var t1 = ani.GetBoneTransform(HumanBodyBones.LeftHand);
- var t2 = ani.GetBoneTransform(HumanBodyBones.LeftFoot);
- Debug.Log(t1.name + " " + t1.position);
- Debug.Log(t2.name + " " + t2.position);
- }
- public void UpdateBoneScale(EditableBodyPart part,float value)
- {
- CustomRoleUtility.UpdateBoneScale(ani, part, value);
- }
- public List<Transform> GetBonesTrans()
- {
- var bonesTrans = new List<Transform>();
- //foreach (var item in Enum.GetValues(typeof(HumanBodyBones)))
- //{
- // if(item == null)
- // {
- // continue;
- // }
- // var trans = ani.GetBoneTransform((HumanBodyBones)item);
- // if(trans)
- // {
- // bonesTrans.Add(trans);
- // }
- //}
- Debug.Log(Enum.GetValues(typeof(HumanBodyBones)).Length);
- for (int i = 0; i < Enum.GetValues(typeof(HumanBodyBones)).Length - 1; i++)
- {
- Debug.Log((HumanBodyBones)i + " " + i);
- var trans = ani.GetBoneTransform((HumanBodyBones)i);
- if (trans)
- {
- bonesTrans.Add(trans);
- }
- }
- return bonesTrans;
- }
- }
|