Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 ADAMN721 · May 27, 2017 at 03:17 PM · unity 5animatorik

OnAnimatorIK Help

Okay so I can't believe I'm hung up on this but I have read every thread out there and I can't seem to figure out why OnAnimatorIK is not being called.

I have a character which already has basic movement animations. I created an IK script and put it on the same gameobject the animator is. I then checked the IK pass box in the layer( there is only one layer right now). When I debug, my OnAnimatorIK never get's called.

Please any insight as to what I'm missing because I seem to be failing to find it.

Here is the code for my IKHandling

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class IKHandling : MonoBehaviour {
 
     private Animator Animator;
 
     public float IKWeight;
 
     public Transform LeftIKTarget;
     public Transform RightIKTarget;
 
     public Transform HintLeft;
     public Transform HintRight;
 
     private void Start()
     {
         Animator = GetComponent<Animator>();
     }
     private void OnAnimatorIK(int layerIndex)
     {
         Animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, IKWeight);
         Animator.SetIKPositionWeight(AvatarIKGoal.RightHand, IKWeight);
 
         Animator.SetIKPosition(AvatarIKGoal.LeftHand, LeftIKTarget.position);
         Animator.SetIKPosition(AvatarIKGoal.RightHand, RightIKTarget.position);
 
         Animator.SetIKHintPositionWeight(AvatarIKHint.LeftElbow, IKWeight);
         Animator.SetIKHintPositionWeight(AvatarIKHint.RightElbow, IKWeight);
 
         Animator.SetIKHintPosition(AvatarIKHint.LeftElbow, HintLeft.position);
         Animator.SetIKHintPosition(AvatarIKHint.RightElbow, HintRight.position);
     }
 }

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 ADAMN721 · May 27, 2017 at 04:10 PM 0
Share

Still struggling with this. Starting to think this is a Unity bug.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by ADAMN721 · May 27, 2017 at 07:40 PM

Just figured out my problem. It was that my rig & animation clips were not set to humanoid.

Comment
Add comment · Show 2 · Share
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 Spyjack83 · Jan 16, 2018 at 11:25 AM 2
Share

That's right. Thank you ! Switch imported rig to humanoid and activate the checkbox "I$$anonymous$$ Pass" in the layer of the animation controller. And OnAnimatorI$$anonymous$$ () works.

avatar image jamesnw Spyjack83 · Aug 09, 2018 at 04:05 AM 1
Share

The docs don't even mention "I$$anonymous$$ Pass" needs to be set, which is very sad. I wasted so much time on this until I read your post, thanks. ;)

avatar image
1

Answer by the_Whizzkid · Jul 08, 2020 at 10:32 AM

@ADAMN721: Thanks for the hint where to look, I solved it now different (with Unity 2019.4: ) in the Animator, Layers, Layer -> Options/Settings : marked the "IK Pass" and it works.

Comment
Add comment · Show 1 · Share
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 imjusthere · Apr 23, 2021 at 04:40 PM 0
Share

This did it for me. THANK YOU!

avatar image
0

Answer by Ghosthowl · Apr 10 at 01:28 AM

I also had the same problem and nothing worked for me and I finally realized the script MUST be on the same object that the Animator component is attached to or it will not be called.

Comment
Add comment · Share
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

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

135 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

SetIKHintPosition and SetIKHintPositionWeight seems to have no impact. 0 Answers

Issue with mecanim playing an animation using setbool 1 Answer

i have problem with animation play via script 3 Answers

My animations are messed up 1 Answer

Animator in Unity 5 0 Answers


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