Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 xxluky · Jul 18, 2015 at 11:39 AM · animationanimator

How to play one animation using animator on different positions?

Hello everybody,

I have a problem. I created an animation on a gameobject RedApple. Then I added a component animator to the RedApple and linked the animation using SetBool when triggered. Then I added a GreenApple to the scene to a different possition, added an Animator component and linked the same animation. The result I want is to play one animation on different positions. What I get is same animation on one position where the animation was created even when two different gameobjects have different positions... How should I solve it?

Thanks a lot.

Comment
Add comment
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

1 Reply

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

Answer by GiyomuGames · Jul 18, 2015 at 12:10 PM

Edit: I put one of my comments as an answer:

You need to recreate your animation.

  1. Create one empty object called RedAppleParent

  2. Under this object put your RedApple sprite or 3D model (the object that was initially your main object)

  3. Don't forget to put RedApple position at (0, 0, 0)

  4. Create your animation on RedApple. You can modify x, y and z for your animation.

  5. That's it! Prefabify RedAppleParent so you can put many of them in your game

If you want GreenApple:

  1. Start from a RedAppleParent

  2. In the GameObject menu chose > Break prefab instance

  3. Rename your object to GreenAppleParent

  4. Inside the GreenAppleParent rename RedApple to GreenApple and modify its sprite

  5. That's it! Prefabify GreenAppleParent so you can put many of them in your game


Initial answer: When you recorded your animation you probably recorded the transform position at the same time. Therefore the animation forces the object to be at a certain position. Remove the transform keys (x, y, z) from your animation and you should have better results.

Comment
Add comment · Show 7 · 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 xxluky · Jul 18, 2015 at 12:25 PM 0
Share

Hey, thanks for your reply. That is true. But I want to animate the gameobject moving on it's Y axes. When the player collects the gameobject I want the gameobject to jump up and down and then dissapear. I use position and scale in my animation. When I remove the X axis, my animation is broken...

avatar image xxluky · Jul 18, 2015 at 12:31 PM 0
Share

I read something about placing the animated object into parent gameobject. Is it my case? How shoud I exactly do it?

avatar image GiyomuGames · Jul 18, 2015 at 12:36 PM 0
Share

That is correct. Put your object under a parent so your animation only modifies the y (and/or x) of your object relatively to the parent. As you result you can put your parent object wherever you want and it will work.

avatar image xxluky · Jul 18, 2015 at 12:42 PM 0
Share

I don't understand. I have about 50 objects to be animated. Should I put them all under a parent object? Do I have to create the animation from the beggining? And where should I place the animater - to the parent gameobject or to my 50 objects that will to be animated?

avatar image GiyomuGames · Jul 18, 2015 at 12:57 PM 0
Share

Sorry let me re-explain. You need to recreate your animation indeed.

  1. Create one empty object called RedAppleParent

  2. Under this object put your RedApple sprite or 3D model (the object that was initially your main object)

  3. Don't forget to put RedApple position at (0, 0, 0)

  4. Create your animation on RedApple. You can modify x, y and z for your animation.

  5. That's it! Prefabify RedAppleParent so you can put many of them in your game

If you want GreenApple:

  1. Start from a RedAppleParent

  2. In the GameObject menu chose > Break prefab instance

  3. Rename your object to GreenAppleParent

  4. Inside the GreenAppleParent rename RedApple to GreenApple and modify its sprite

  5. That's it! Prefabify GreenAppleParent so you can put many of them in your game

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

23 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

Related Questions

2D Animation does not start 1 Answer

Accessing AnimationState in Animator 0 Answers

How to do controlled oscillation in animator? 1 Answer

AnimatorItemCollectionData.GetState (Int32 layer, Boolean moving) (at Assets/Third Person Controller/Scripts/Utility/AnimatorStateData.cs:368) 2 Answers

Checking animation playing in ieunmerator. Is there a better way to do this? 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