• 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
Question by superme2012 · Aug 06, 2013 at 06:30 PM · animationrotationparentbiped

Unity general animation, bones root node rotation to parent container!

For three days I have been trying to find a way where the root node of any type of animation could be used to rotate the parent container.

The idea is that the animation’s rotations (root node or controlling node rotations) also rotate the parent container, resulting in the "parent container" always facing in the correct direction of the animation front, no matter what state it ends in.

T$$anonymous$$s has some good advantages and I would really like to find a solution to the problem. See the image at bottom for what I I'm referring to as the "parent container".

I have been focusing on the Y axis as it’s the most important and I have tried many workarounds but all result in the obvious. The container is a parent and in result any applied rotation also affects the c$$anonymous$$ld objects.

Now t$$anonymous$$s just maybe very simple to resolve, if so just slap me with it ;)

alt text

questionforunityforums.jpg (30.5 kB)
Comment

People who like this

0 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 Xtro · Aug 06, 2013 at 07:46 PM 0
Share

What you are trying to do is not clear. For me at least.

by "root" node, do you mean "Bip01" node? Because I think root node is the same one you named as parent container.

Which one do you want to rotate and which one not to rotate?

Can you give a specific example about what you want to do.

2 Replies

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

Answer by scarletshark · Aug 06, 2013 at 07:51 PM

I really can't t$$anonymous$$nk of a situation where you would want to do t$$anonymous$$s... You realize that rotating a parent of a bone based on the bone's rotation would result in 2x the rotation of the bone?

It sounds like what you really want is for the animation to drive the character rotation / translation? If so, you need to look into Mecanim. It simplifies the whole process, and uses character animation as the driver for the movement of the character controller. YouTube Tutorial

But if you really wanted to do t$$anonymous$$s (w$$anonymous$$ch I assure you will give you unwanted results...)

 GameObject spine = GameObject.Find("m002_$$anonymous$$_max2008_01/Bip01 Pelvis/Bip01 Spine");
 GameObject moo = GameObject.Find("/m002_$$anonymous$$_max2008_01");

 void Update(){
     moo.Transform.Rotation.y = spine.Transform.Rotation.y;
 }

Can't check t$$anonymous$$s right now, but you might not be able to set y rotation directly.

Comment
Xtro

People who like this

1 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 Xtro · Aug 06, 2013 at 07:54 PM 1
Share

These are the exact same sentenced I thought when I read the question. Mecanim is the right way!

avatar image

Answer by superme2012 · Aug 06, 2013 at 08:55 PM

Yeah I will scrap t$$anonymous$$s idea and use mecanim humanoid. Thanks for the help.

Comment

People who like this

0 Show 5 · 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 scarletshark · Aug 08, 2013 at 02:27 AM 0
Share

Please don't forget to accept my answer! Always accept the correct answer (the checkmark next to the answer). It helps people get credibility for answering more questions :)

avatar image superme2012 · Aug 09, 2013 at 11:16 PM 0
Share

Hi, I didn’t give it a plus 1 as there is a much easier way to do it. The trick is to add a parent container then move the child out, rotate parent and reset child’s parent.

It’s very easy to do and can’t believe I didn’t work it out sooner.

I should have also mentioned that I am using mecanim generic, the problem I was facing was due to animation doing a full rotation but the container still facing in the opposite direction.

Anyway after more problems I decided to start looking at angular rotation and direction using a navagent. I'm going to use an in place sidestep type animation with a blend tree, hope this works ;)

avatar image scarletshark · Aug 10, 2013 at 01:44 AM 0
Share

@superme2012 Whatever you are doing is very uncommon, and does not represent what most developers would do in your situation. I believe your problem is that you have your character model inside another game object.... and you're wanting that game object to rotate. Your solution will work, but I wouldn't recommend it unless absolutely necessary.

I was referring to Mecanim's built-in ability to rotate and translate objects based on animation data. See this video I made for you: Mecanim Rotation

In that video, I have the "parent node" selected, which is the character model file titled "robot." It is assigned a mecanim animator... Inside the parent node are the bones and mesh. As you can see, the "parent node" rotates perfectly according to the animation data.

avatar image superme2012 · Aug 10, 2013 at 04:04 AM 1
Share

What I'm doing is very uncommon, after tweaking some code last night I managed to get the functionality I was looking for. I did it already but didn’t notice due to the scruffy code lolz

That video is very interesting, I cannot alter any aspect of the bones, in doing so has some nasty results.

What you did was in most cases the solution so I give it the thumbs up.

avatar image scarletshark · Aug 10, 2013 at 04:06 AM 0
Share

Thanks! Glad you figured it out.

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

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

How do I rotate an animation? 1 Answer

How to correct the First Person Controller orientation when parenting to a rotated x.270 degrees model? 2 Answers

Unity Animation: Rotating only One Axis 0 Answers

Child object ignores transform animation in parent object 0 Answers

Animating the 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