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 zombience · Jan 09, 2013 at 10:30 PM · animatortrackingmechanimskeletonzigfu

manually control bone while animations handle skeleton

This is my first foray into mechanim, and I'm liking it so far! I'm looking into one situation that I'm not sure how to tackle:

I have a skeleton that is being controlled by animations, but at certain points I'd like to free up the hands and have them directly controlled by skeleton tracking (using zigfu, which is awesome).

I'm not sure how to override the animations in order to manually dictate (through zigfu) the locations of each targeted transform.

I'm currently looking into body masks, but I might need something else in conjunction, since even an arm body mask would still attempt to control the arms via animation.

Any ideas in which direction I should be researching? Thank you in advance

Comment
Add comment · Show 2
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 Polymo · Jan 09, 2013 at 11:52 PM 1
Share

i have not played with mechanim yet and dont know zigfu, but i would just move/rotate the bone directly inside LateUpdate().

avatar image zombience · Jan 10, 2013 at 05:09 PM 0
Share

yep! this seems to work. if you ever have need of skeleton tracking via kinect, i'd highly recommend zigfu. I've only played with it a very little bit, but so far it seems really useful and very good and detecting and holding onto skeletons

2 Replies

· Add your reply
  • Sort: 
avatar image
-1
Best Answer

Answer by zombience · Feb 05, 2013 at 07:15 PM

I've actually found a better way to do this. there is a method, OnAnimatorIK(int layerIndex) that gives access to the animator at the time that it is computing the IK weights and targets.

You can set targets and weight for parts of the skeleton, and the animator will work with you to move the desired bones to the IK targets. I've implemented this with a zigFu input, and it works really really well. The animator still handles all bone lengths and relationships appropriately, whereas manually overriding bone transform locations in LateUpdate() ignores the bone and muscle relationships and therefore has really awful results if you don't write your own custom bone management.

So, a code snipped like this works wonders:

 void OnAnimatorIK(int layerIndex)
 {
 
     if(avatar)
         if(ikActive)
 {  avatar.SetIKPositionWeight(AvatarIKGoal.LeftFoot,leftFootWeightPosition);
                   avatar.SetIKRotationWeight(AvatarIKGoal.LeftFoot,leftFootWeightRotation);
 }
 
 }
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 RickyX · Mar 11, 2014 at 08:45 PM 0
Share

What should avatar be ? ikActive is bool i think but what do we do with avatar ? Same ?

avatar image RickyX · Mar 11, 2014 at 08:49 PM 0
Share

Oh it's Animator, sorry.

avatar image
2

Answer by MalikDrako · Jan 10, 2013 at 12:55 AM

Take a look at http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html

LateUpdate() happens after animations have been applied and before rendering, so you can manually specify the locations of the transforms there. Just remember that any changes you make will be overridden for the next LateUpdate(), so you either need to specify an absolute position, or store a copy of the position that you can specify the position relative to

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 zombience · Jan 10, 2013 at 05:10 PM 0
Share

thank you. i've switched up my scripts to do this and it seems to work well so far. this does seem like a bit of a brute force method. the animations are still processing movement and position, and I'm just overriding that with a later call. I'll work with this for now, but keep searching for a more elegant method. Thanks!

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

11 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

Related Questions

Imported Blender Animations not Working 2 Answers

Continuously Play Animation Forwards and Backwards with Mechanim 0 Answers

Animation Transitions, Mechanim, Animator Overview Gizmos. 0 Answers

How to nest Animation file in an Animation Controller? 1 Answer

Why do my animations only play once? 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