Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by NavySeal · Apr 13, 2013 at 06:56 PM · c#animationtransformbone

Attaching an object to an ongoing animation

My character is a prefab, when i equip the character boots, i cut its feet and give the boots the same transform.parent, rotation and position. But the boots don't act like the feet. The animation is still running for the rest of the body but the boots won't move

I cannot set the boots animation because its a read-only property

what am I missing?

this is what I'm doing in C#

 // find the feet
 GameObject playerFeet = GameObject.FindWithTag("feet");
 
 // activate the item
 equipItem.setActive(true);
 
 // replacing the feet by the item
 equipItem.transform.position = playerFeet.transform.position;
 equipItem.transform.rotation = playerFeet.transform.rotation;
 equipItem.transform.parent = playerFeet.transform.parent;
 
 // makes the feet vanish
 playerFeet.SetActive(false);

==update==

I work with feet, not left foot and right foot

=============

thanks

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 Loius · Apr 13, 2013 at 07:14 PM 0
Share

well, your character can't have a 'feet' transform. it must have left foot and right foot... right?

For static things (like plate armor, sandals, stuff that doesn't need to bend within its own mesh), you just use

leftBoot.transform.parent = leftFoot

If the boot needs to animate along with the foot, someone else will chime in with that answer. I can never remember quite how to get that working.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Jazzer008 · Apr 20, 2013 at 03:01 PM

So, if your default feet are animating with the player, then those are the objects with the animation data.

Personally I would make the feet's renderer inActive, instead of setting the game object to inActive. Then parent the new boots to the feet. That way, the old feet will still move with the animation, but will not render, and your new boots will follow the transform of the old feet.

 equipItem.transform.parent = playerFeet.transform;
  
 // makes the feet vanish
 playerFeet.renderer.enabled = false;
Comment
Add comment · Show 8 · 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 NavySeal · Apr 20, 2013 at 03:59 PM 0
Share

my problem is that im new in unity. Your solution didn't work.Also already had tried to keep the feet enabled before. The problem is that Im not an animator and dont quite understand how all components fit together. heres a screenshot of the hierarchy, it might help you helping me to understand what im doing wrong. alt text

hierarchy.png (3.6 kB)
avatar image Jazzer008 · Apr 20, 2013 at 04:02 PM 0
Share

Ok, I was fairly sure that that would work. :D

I'm just going to test it in my own Unity and try and find the issue. Back in 5 $$anonymous$$utes. :P

Edit: Ok, I just checked and I parented a new object to a moving part and the new object moved with the part.

Why don't you try adding the new boots as a child, to your female_feet object, in the editor. Then play the game and see if they follow the transform of the feet.

avatar image NavySeal · Apr 20, 2013 at 04:15 PM 0
Share

forgot to say changing the animator culling mode from based on rendered to always animate made the boots animate... but then the body stopped :\

avatar image Jazzer008 · Apr 20, 2013 at 04:35 PM 0
Share

So here's my result

You can see the attached sphere is moving with the animated part that it is parented to.

I have a feeling that my animation is quite different from yours though. I have no bones and the animation is stored in the root.

Are you using bones? And could you take a picture of your 'rig' page, showing the import settings of the animation in the inspector.

avatar image NavySeal · Apr 20, 2013 at 05:21 PM 0
Share

yes its different, that ball is only following the other component. So all you are doing is using transform coordinates. This is a bit different. The boots are following the feet... they are just not using the same animation. we're using a mecanism compatible rig and an animation from a unity mecanism demo package for testing

Show more comments

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

How to control bones with code? 0 Answers

"Lerp" back to original position after animation. 0 Answers

Having an animation enabled locks transform changed in the animation 3 Answers

Capture positions and rotations of all bones at a specific frame of an animation clip 1 Answer

Distribute terrain in zones 3 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