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
2
Question by alexanderflink · Mar 28, 2013 at 04:54 PM · rotationmecanimbone

Override mecanim animation with manual bone rotation

Hi! I want my character's arms to rotate according to how the right gamepad stick is pressed. This is no problem in itself, however, whenever i apply my animator controller to my character, the bones I try to rotate (in the update function) are not being affected. It is as if the script-controlled rotation is being overridden by the animation that is played. How do I make my script-controlled rotation override the mecanim animation when the player pushes the right stick?

Thanks

Comment
Add comment · Show 6
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 alexanderflink · Mar 28, 2013 at 07:53 PM 0
Share

Anyone? How about disabling my animation just for the arms? How would I do that?

avatar image alexanderflink · Mar 28, 2013 at 08:55 PM 0
Share

This must surely be a common problem. Is there no easy solution?

avatar image alexanderflink · Mar 28, 2013 at 09:13 PM 0
Share

Okay, Update! transform.Rotation seems to not work. However, transform.LookAt works just fine (in the LateUpdate function). This is reaaally weird. Could anyone explain this, or is it perhaps a bug?

avatar image whydoidoit · Mar 28, 2013 at 10:47 PM 1
Share

It's like Louis explained below - your Rotate was adding a rotation to the existing one. transform.rotation will work too.

Do not do this in FixedUpdate - that is for physics only. Do it in LateUpdate.

avatar image alexanderflink · Mar 29, 2013 at 12:36 AM 0
Share

Oh, right. I meant LateUpdate there! I understand now. Thank you.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by whydoidoit · Mar 28, 2013 at 05:22 PM

I'm no mecanim expert but it will probably work if you override the mecanim rotations in LateUpdate.

Comment
Add comment · Show 3 · 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 alexanderflink · Mar 28, 2013 at 06:15 PM 0
Share

I tried doing that by putting this in LateUpdate() of the bone:

 transform.Rotate(0,30,0);

But to no avail. The arm stays put in a rotation of 30 degrees, it does not increment like it should...

avatar image alexanderflink · Mar 28, 2013 at 06:16 PM 0
Share

If I remove the animator though, that same code makes the arm spin.

avatar image Loius · Mar 28, 2013 at 09:36 PM 2
Share

That's because animation is setting the rotation in Update and then you're rotating that by thirty degrees, which is always the same. You need to track exactly where you want the arm to be, not just its rotation speed.

avatar image
2

Answer by petersvp · Aug 14, 2015 at 12:22 PM

LateUpdate is your best friend for rotation patching. In LateUpdate, you have the Mecanim results, and you must calculate yourself how to exactly patch the provided rotations.

Yes, your 100% custom IK code should go in LateUpdate, and everything you need and OnAnimatorIK does not provide :)

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 Dljcali82 · Mar 20, 2020 at 09:49 PM 0
Share

Does anybody know how to send this information through online on Photon? I can get the lateupdate to work but not through a RPC call which sends the information as I want it but not update the rotation. :/

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

16 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

Related Questions

Mecanim 'extra' root bone rotation 0 Answers

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

MakeHuman - Blender - Mecanim, rotation problem 1 Answer

Mecanim position specific bone 0 Answers

How to convert quaternion to vector3 with specific multiplication order? 5 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