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 Lairinus · May 19, 2013 at 12:03 AM · c#animationquaternionslerp

Rotating Armature During Animation

Hello,

Just as the question asks.

The problem is that I can't seem to Quaternion.Lerp or Slerp while my armature is doing an animation. I want to rotate JUST the armature, as it's primary purpose is an aesthetic.

I've tried keeping the Slerp in LateUpate() method as well, but to no avail. The Slerp starts and then gets shut down every frame.

The ultimate purpose of this is to use ONE walk animation instead of making 8 for each of the directions.

My code :

     void PlayMovementAnimation()
     {
         if (gravity.isGrounded)
         {
             switch (actionManager.movementState)
             {
             case ActionManager.MovementState.Creeping:
                 //Play Creeping Animation
                 break;
             
             case ActionManager.MovementState.Normal:
                 if (!parent.parentObject.animation[walk.anim.name].enabled)
                 {
                     Debug.Log ("playing");
                     parent.parentObject.animation.CrossFade(walk.anim.name);
                     break;
                 }
                 else
                     break;

That method is in the Update() method.

Another code snippet:

     void Movement()
     {
         switch (movement.direction)
         {
             case MovementManager.Direction.Forward:
                 root.transform.rotation = Quaternion.Lerp (root.transform.rotation, rotationScript.forward.rotation, Time.deltaTime * rotationScript.rotationSpeed);
                 break;
             
             case MovementManager.Direction.ForwardLeft:
                 root.transform.rotation = Quaternion.Lerp (root.transform.rotation, rotationScript.fowLeft.rotation, Time.deltaTime * rotationScript.rotationSpeed);
                 break;

That method is in the LateUpdate() method.

The only solution that I can think of at this point would be to either rotate the whole model (NOT a viable option) or AddMixingTransform() all except the root bone and rotate the root (I'd lose root motion, though).

Thanks for any help!

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 Lairinus · May 19, 2013 at 08:59 PM 0
Share

Bumping this question.

Upon further research yesterday, I found that it's not possible to (S)Lerp a root bone or armature during animation, but it IS possible to increment it.

Incrementing makes it a hell of a lot harder, though. Especially finding the shortest distance between two angles and deciding whether to go negative or positive with the increment.

Does anyone have a solution for shortest-angle incrementing?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Lairinus · May 20, 2013 at 10:47 PM

The answer was SOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO incredibly simple that I'm ashamed to even post the answer here.

For anyone who wants to know, the only thing you have to do is AddMixingTransform the root bone. After that, it rotates no problem in any direction.

I just went through making like 12 failures of angle interpolation scripts in order to do this, and 3 days later I try to do the most simple thing out of desperation and it works. I thought locking the root would have the inverse effect.

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

13 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

Related Questions

Slerp Rotation Problem 2 Answers

how to rotate an object smoothly 2 Answers

Multiple Cars not working 1 Answer

i want to get my to cube to rotate 90 degrees on the x-axis as it jumps 0 Answers

Quaternion Smooth Rotation 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