Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Florian-Nouviale · Mar 14, 2013 at 11:20 PM · rotationmecanimik

Problem with rotations and IK

Hello,

I ran into a problem this week with IK regarding rotations. I was able to reproduce the problem (or is it just me not understanding how IK works ?) using the following script:

 public class HumanoIKControl : MonoBehaviour {
 
     Animator avatar = null;
 
     // Use this for initialization
     void Start () {
         avatar = GetComponent<Animator>();
 
     }
 
     void OnGUI()
     {
         if (GUILayout.Button("FakeIK"))
         {
             avatar.SetBool("FakeIK", true);
         }
     }
 
     void Update()
     {
         if (avatar.GetBool("FakeIK"))
         {
             Debug.Log(" Update " + avatar.GetBoneTransform(HumanBodyBones.LeftHand).rotation.eulerAngles.x);
         }
     }
 
     void OnAnimatorMove()
     {
         if (avatar.GetBool("FakeIK"))
         {
             Debug.Log("AnimatorMove " + avatar.GetBoneTransform(HumanBodyBones.LeftHand).rotation.eulerAngles.x);
         }
     }
 
     void OnAnimatorIK()
     {
 
      
          if(avatar.GetBool("FakeIK"))
         {
             avatar.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
             avatar.SetIKRotationWeight(AvatarIKGoal.LeftHand, 1);
 
              Debug.Log("IK " + avatar.GetBoneTransform(HumanBodyBones.LeftHand).rotation.eulerAngles.x);
             
             avatar.SetIKPosition(AvatarIKGoal.LeftHand, avatar.GetBoneTransform(HumanBodyBones.LeftHand).position);
             avatar.SetIKRotation(AvatarIKGoal.LeftHand, avatar.GetBoneTransform(HumanBodyBones.LeftHand).rotation);
         }
       
         else
         {
             avatar.SetIKPositionWeight(AvatarIKGoal.LeftHand, 0);
             avatar.SetIKRotationWeight(AvatarIKGoal.LeftHand, 0);
 
         }
     }
 
 }


I attached this script to the U_Character_REF avatar from the tutorial to be sure the problem was not coming from my own avatar (which presents the same strange behaviour)

When I activate FakeIK through the GUI button, the left hand position remains the same but its rotation changes on time and then stays fixed.

I thought my code was supposed to not move the hand since I ask the IK to put it at the exact same position and rotation as it is, or maybe am I missing or misunderstanding something ? Of course, the same goes with the other hand and the feet

Here is the output I get in the console regarding the X euler angle

It first shows this :
Update 308.2965
AnimatorMove 308.2965
IK 308.2965

and then loops showing this :
Update 358.4016
AnimatorMove 358.4016
IK 308.2965

I don't understand why the value changes after the first IK pass and why it is different only in the IK pass afterwards

Thanks !

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Florian-Nouviale · Mar 15, 2013 at 01:24 PM 0
Share

Ok, for my last question, the value of I$$anonymous$$ is the value before I$$anonymous$$ occurs, that explains the difference on this part. But I still don't get why there is this offset between the rotation I ask for and the rotation I$$anonymous$$ gives

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Mecanim IK Foot Rotation 2 Answers

How to Aim Animator.SetIKRotation() to direction WRT hand bone rotation offset 0 Answers

How do you manually override mecanim's interpolation with rotations? 2 Answers

Mecanim ik curve 0 Answers

Making hands move with weapom 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges