• 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 Salarn · Jul 17, 2014 at 03:53 PM · animation2droot motion

2D Animation position translation

I've been searching for a simple solution for this but couldn't find an solid answer one way or another.

I have a sprite. I have an animation that moves the sprite in a direction.

I would like to be able to loop this animation and have the sprite play each loop at the end of the last one instead of reseting to the start location at the beginning of every loop.

I've put the sprite into a anchor game object that will update via script the position of the object to match that of the sprite at the end of the animation. However due to the update timing it's not always accurate, the callback is hit before the animation updates.

I've created a empty .fbx object with a single boon to act as the avatar with a root bone, but that did not seem to improve anything.

This seems like something that should be pretty common but I've have no luck with searching for an answer.

Comment
Add comment · 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 siddharth3322 · Jul 17, 2014 at 05:24 PM 0
Share

Is it problem regarding animation playing at current position only?

avatar image Pyrian · Jul 17, 2014 at 06:00 PM 0
Share

Do you have Apply Root $$anonymous$$otion checked?

avatar image Salarn · Jul 17, 2014 at 06:03 PM 0
Share

Correct, it doesn't update the transform automatically.

I was hoping there was a way to do this without adding an additional script to update a position on a parent object with an AnimationEvent callback since that solution is clunky especially if the animation changes while playing which might skip over an event.

Ideally I'd like to have the transform updated while the animation plays, which I believe is a job for 'root motion' but haven't been able to get it setup in such a way that it would work like that.

avatar image Salarn · Jul 17, 2014 at 08:21 PM 0
Share

I've tried it with both 'root motion' check and unchecked didn't get any results I wanted. $$anonymous$$y data might be setup incorrectly but as mentioned above, I've tried:

just a sprite

a sprite in an dummy game object

a sprite in a dummy object with a bone

a sprite in a dummy object with a bone inside another dummy object.

$$anonymous$$ust be missing something here.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

My animation barely moves with root motion. 1 Answer

2D Animation does not start 1 Answer

Snapping Child to Root after Animation 2 Answers

"Double transform" on 2D hitboxes when root motion is enabled 0 Answers

Root motion lost in transitions 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges