0

I imported a character from MakeHuman into Unity as .fbx file. Now I am trying to controll the characters parts/skeleton, e.g. the head rotation (see picture below for full skeleton structure), directly with a script, but I am pretty new to Unity. Maybe someone has any tips for me on how to acces the parts of the skeleton.

Character skeleton structure

My guess is to use GetComponent() to access every component one by one, but what is their type? And is there maybe a smoother way which keeps the tree structure?

derHugo
  • 83,094
  • 9
  • 75
  • 115
nik.yan
  • 71
  • 1
  • 11
  • So far i gave every joint a tag 'tag' and got them with GameObject.FindGameObjectsWithTag('tag'), but I would really love to just search for the "CMU compliant skeleton" or "Hips", keep and access the tree structure somehow – nik.yan Jun 08 '18 at 17:10
  • Why do you need to access them, do you need to animate them or what? if you want to animate them then an appropriate way is to use the animator not to accessing each one – WaleedYaser Jun 08 '18 at 21:19
  • I want to controll them with sensor device inputs – nik.yan Jun 09 '18 at 00:13
  • 2
    Then I think you need to define Transform variable for each joint in your code. The easiest thing is to make them public, drag and drop them in the inspector. – WaleedYaser Jun 09 '18 at 00:16
  • Thanks for your answer. How would you do it without using the inspector? I am planing to make the script applicable to several MakeHuman avatars. In case I export and import them all the same way, I might avoid the drag and drop part for every bone – nik.yan Jun 12 '18 at 18:40

1 Answers1

1

If you imported the rig of the character as humanoid and set all bones in the import tap, you could try to get those propertys out of the animator. He should now which gameobject is which bone, case you mapped it for him.

Auri
  • 71
  • 7
  • Thanks for your answer. I did that but I am currently only able to set the position of the hands and feet with `Animator.SetIKPosition()`, but I want to set the other bones' position aswell and maybe implement my own IK solution for the non-tracked body parts with my own constraints etc. – nik.yan Jun 12 '18 at 16:32