• 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 /
This question was closed May 01, 2013 at 10:22 PM by Julien-Lynge for the following reason:

The question is answered, right answer was accepted

avatar image
Question by inglipX · May 01, 2013 at 09:23 PM · animation

Trying to simply play this animation... Help please.

I am using the FPS Controller that comes with Unity. When i press P i want my player to do the "Test" animation which moves it up into the air a litte, basically a jump animation. Whenever i press P it clamps my player to the position that the animation was recorded, it isn't relative to where ever i may move. Why isn't this working? Here is my simple script:

 function Update () {
 
 if (Input.GetKey("p"))
     animation.CrossFade("Test");
 
 }
 
Comment

People who like this

0 Show 2
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 01, 2013 at 09:25 PM 1
Share

Please include a question if you want an answer.

avatar image inglipX · May 01, 2013 at 09:28 PM 0
Share

...Why isn't it playing relative to the position?

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by Julien-Lynge · May 01, 2013 at 09:37 PM

@inglipX,

I'll answer your question this time, but this is a question that should be rejected. With a google search it took me less than 3 seconds to find an answer.

You want a relative animation in unity? Google 'unity relative animation'

First result: http://answers.unity3d.com/questions/10865/relative-animation.html#answer-10869

Comment

People who like this

0 Show 10 · 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 inglipX · May 01, 2013 at 09:44 PM 0
Share

I have googled that plenty of times and I have seen that thread in particular. Nobody has ever explained how to implement it.

avatar image Julien-Lynge · May 01, 2013 at 09:51 PM 0
Share

That's why you need to include context information in your questions, so we know what you've tried already and what exactly isn't working :)

That question does contain an answer with how to implement it:

"I had to put the object inside another GameObject (parent). Then I moved with GameObject instead of the Button.

  Peter"

"Yeah, ran into that one myself. Would be nice if this was better documented. I guess it happens because the animation can contain animated positions as well."

I take it that doesn't make sense to you? This one has how to implement it right in the question (second result in google search):

http://answers.unity3d.com/questions/352879/animations-relative-to-world-space.html

What about these don't you understand? Maybe you can rephrase your question.

avatar image inglipX · May 01, 2013 at 09:55 PM 0
Share

I have tried make a parent of my player with an animation. Still doesn't work. I don't understand how to play the animation at any location. I have looked at those but i just don't understand; i'm not an advanced coder at all.....

avatar image Julien-Lynge · May 01, 2013 at 09:59 PM 0
Share

Alright, I'll try to explain it a different way:

Before you animate, put the thing you want to animate under another game object, as a child.

Then, make your animation. Only move the child. Don't move the parent. When you move the child, it changes the transform position of the child, and the transform position of a child is always relative to the parent.

Then, when you're done recording, you can move the parent anywhere, and the child will animate relative to the parent.

avatar image inglipX · May 01, 2013 at 10:02 PM 0
Share

Okay i will try this, but is the animation of the child on the parent? Or am i just animating the parent?

Show more comments

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

12 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

Related Questions

Multiple Cars not working 1 Answer

Need help with some OnTrigger Scripting 2 Answers

Animation Script Help 0 Answers

Reloading Help 2 Answers

Gameover function calling before game ends help 2 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