• 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 metallurgical · May 29, 2013 at 09:54 AM · animationex2d

Playing different animation with current position

hello guys, how to make my animations playing with current position,,i have 2 animation,the 1st one is right move and 2nd one is left move..this is my code.. var rotationSpeed : float = 100.0; function Update () { //get horizontal var translation : float = Input.GetAxis ("Horizontal") * rotationSpeed; translation *= Time.deltaTime; //decrease speed of animation play for (var state : AnimationState in animation) { state.speed = 0.1; } //move to the right if(translation > 0.2) { animation.CrossFade("run"); } else { animation.CrossFade("idle"); } //move to the left if(translation < -0.2) { animation.CrossFade("run_left"); } else { animation.CrossFade("idle"); } } when i pressing 'a' and 'd' button its going well,, the problem is,when i change my animation movement, it is not play at current location which is the last position before new animation playing...what i want is when change to the new movement, it play at current position,not at the original position of animation..for the animation i'm using ex2d extension to create it..can anyone help me?? if you don't understand please tell me,,

Comment

People who like this

0 Show 4
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 Imran Khalil · May 31, 2013 at 05:15 PM 0
Share

I also want this... If you find the solution plz email me at scorpionfeast@gmail.com

avatar image Vonni · May 31, 2013 at 06:30 PM 0
Share

You need to have your animation object as a child of another object. This way you play your animations locally. Use root object to move.

avatar image metallurgical · Jun 01, 2013 at 09:38 AM 0
Share

You need to have your animation object as a child of another object. This way you play your animations locally. Use root object to move.

i already try to put my animation into parent, and how can i move the root??

avatar image metallurgical · Jun 01, 2013 at 09:39 AM 0
Share

@Imran Khalil, orite man..

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Julien-Lynge · May 31, 2013 at 08:44 PM

http://forum.unity3d.com/threads/53832-Playing-Animation-Local-to-Position-in-Unity

Comment

People who like this

0 Show 2 · 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 Julien-Lynge · May 31, 2013 at 08:44 PM 0
Share

Also about a dozen other posts - try looking around here and on the forums.

avatar image metallurgical · Jun 01, 2013 at 09:44 AM 0
Share

there are a dozen out there but all the post is hardly to understand and the example given are out of my imagination since i'm newbie in unity.. can u give me example on how to achieve this..helpppp me..

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

What is wrong with my EX2D code? 1 Answer

Best way to equip a 2D character? 1 Answer

Preallocated ex2D sprite animation object not animate. 1 Answer

Can I make animations snap to a frame? 0 Answers

How to create animation sprite with ex2d unity extension 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