• 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
1
Question by GameDev_Chuck · Jun 04, 2015 at 07:58 PM · rig

How to Override Bone Animation and still optimize game object

Hello,

I'm trying to figure out how to override bone animations while maintaining game object optimization, but so far nothing I've found online seems to be working. I've created a simple test scene to try and figure it out. In the scene, there is a generic rig with just two bones. Each bone has a connected box mesh.

alt text

The armature has 1 animation where the top box, Box_2, tilts front to back to front again and just loops. I've also created a simple script that should set the local rotation of a bone to (0, 0, 0) in the LateUpdate() function when pressing the S key.

 using UnityEngine;
 using System.Collections;
 
 public class OverrideAnimScript : MonoBehaviour
 {
     public Transform boneTransform;
 
     void LateUpdate()
     {
         if (Input.GetKey(KeyCode.S))
         {
             boneTransform.transform.localRotation = Quaternion.Euler(Vector3.zero);
         }
     }
 }

When I import the file into a unity project, and set it up with the generic rig. I have the choice of optimizing the Game Object under the 'Rig' portion of the import settings. I've found that if I leave it unchecked, then everything works as expected. However, if I do select 'Optimize Game Object', the script no longer overrides the animation. I've tried exposing every single bone on the armature but will not work. I was just wondering if anyone else has run into this issue and figured out how to get around it.

Thanks for taking a look :)

boxes-image-01.png (18.9 kB)
Comment
Add comment · Show 5
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 Kazioo · Feb 12, 2016 at 02:10 PM 0
Share

There seems to be some contradicting info on Google (maybe it worked in some versions of Unity?), but my experience with exposed bones is identical. I think they are just read-only, which is a shame.

avatar image Cherno · Feb 12, 2016 at 03:59 PM 0
Share

Have you tried it with a Legacy rig?

Show more comments
avatar image meat5000 ♦ · Feb 15, 2016 at 01:06 PM 0
Share

Perhaps you could attempt to perform the rotations are I$$anonymous$$ targets in OnAnimatorI$$anonymous$$ callback.

While rotating bones in LateUpdate does work, having Get$$anonymous$$ey polls in there is not a good idea, rotations fight with the animation and as the rotations are transform based, collisions detections may fail. OnAnimatorI$$anonymous$$ and OnAnimator$$anonymous$$ove work together with the Animator for mixing Animation and manual movement to keep Root $$anonymous$$otion updated.

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

24 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

Related Questions

bone animations only? 1 Answer

Unity3d not properly importing rigs? 1 Answer

Why doesn't unity import animations unless it's unattached or rigged? 0 Answers

How to reuse character rig? 1 Answer

How can I export humanoid from Poser to Unity? 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