Does unity support the control of a specific bone? For example, If a character walks by an NPC, can you have the NPC’s neck and head bone follow the character? I want the NPC to look at you as you walk by, but just it’s head or neck. Does Unity support this? Think Skyrim if you have played it.
Bones are just transforms, you use them the same way as any other transform.
–Eric
I am sort of a beginner to programming/unity, I take that as a yes? lol How do you access control of individual bones in Unity?
Like this:
www.google.com → “unity access bones” : )
controlling transforms is pretty easy, it is all documented clearly in the Unity API- here is a link to what you need:
Basically the idea is this:
You use scripting to tell Unity to rotate and orient the forward vector (direction that bone is looking/facing) towards a target; which in your case you want to be the player, most likely the player’s head bone (if a 3rd person game) or the player camera (if it’s an FPS)- hope that makes sense.
If you’ve never scripted before, this might be difficult for you? For even beginner scripters, this is very easy to implement and code. Should take only a few minutes to do. There are other things to take into account though, for example, when NPC’s start looking at the player, you will have to code limits to the amount of rotation, unless you want their heads to rotate all the way around like an owl or the excorcist ![]()
Also, you’ll need to think about how this should play out with your A.I., and there are other things to consider- you’ll find out once you begin implementing this ![]()
Awesome information guys, thank you very much. I am implementing this with uScript, the visual scripting plugin, and your information is a great help.
I made an account just to tell you it’s easier to just say nothing than be smarmy and tell people to use google. I was running into the same problem, googled it and ran into your lame answer.
After digging around, I found the answer to OP’s question: (in C#)
Transform animBone = animatedGameObject.transform.Find(“rootBone/boneName”);
You can perform any translation/rotation/whatever to animBone afterwards. Don’t worry about people like Virror, they’re just obstacles in human form.
thank you burntReynolds and i3DTutorials