Basic-Unity-Head-Rotation | humanoid head in Unity | Animation library
kandi X-RAY | Basic-Unity-Head-Rotation Summary
kandi X-RAY | Basic-Unity-Head-Rotation Summary
Rotating a humanoid head in Unity 3D by scripting. Trying to get it to work by muscle value or bone rotation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Basic-Unity-Head-Rotation
Basic-Unity-Head-Rotation Key Features
Basic-Unity-Head-Rotation Examples and Code Snippets
Community Discussions
Trending Discussions on Basic-Unity-Head-Rotation
QUESTION
I would like to rotate a head of a humanoid character given x, y, z rotation values using a script (without using any other object in the scene as "look" direction).
What I want to doWhen setting-up the rigging of a Humanoid character (humanoid prefab --> Rig --> Animation Type: Humanoid --> Configure --> Muscles & Settings), you see the following interface: https://docs.unity3d.com/Manual/MuscleDefinitions.html
In this menu, under Head, you can drag a slider to move e.g. your humanoid head up and down. I want to achieve the same with a script, but I don't know how to do this.
ResourcesThis question never received a proper answer with example code: https://answers.unity.com/questions/824628/can-we-using-script-to-moving-the-muscles-in-unity.html
I presume I have to do something with HumanPose.muscles
(https://docs.unity3d.com/ScriptReference/HumanPose-muscles.html), however with the lack of code samples, I have no idea how to approach this.
Edit 3: This link has a code sample for HumanPose, but I didn't get it to work yet: https://forum.unity.com/threads/humanposehandler.430354/
QuestionHow to get the head muscles of a humanoid character and rotate them by giving values through a script? (Or any other way how to rotate the head using head rotation values, without another object in the scene). Any help would be appreciated.
Edit 1 & 2: Sample codeI receive a JSON formatted message from which I extract the radian values and change it into degrees:
...ANSWER
Answered 2018-Feb-12 at 19:29After testing for a while, I figured it out.
- Firstly, set the
animator
toIK
Pass.
- Then use
SetBoneLocalRotation
insideOnAnimatorIK
method. You can know more about this method here: https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAnimatorIK.html
Following is the modified code that worked for me
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Basic-Unity-Head-Rotation
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page