Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Fogsmoke · Nov 26, 2014 at 12:04 AM · rotationanimatorpositionlocation

Why is my game object (door) changing rotation in game mode?

I have a door that looks fine in scene view. It has an animator attached that switches from open to closed based on a Boolean parameter. The animation works fine. But when running in game mode, the door always resets its starting transform rotation to 0. When I uncheck the animator on the object (deselecting it) it maintains its location that I set. Why is the animator resetting its location position? Please forgive my noobness.

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 Salmjak · Nov 26, 2014 at 09:17 AM 0
Share

Hmmm... Go to the "animation" tab (yes, not "animator") and record the animation while making sure it has the right rotation in the scene. This should now change the animation so that it won't "reset" your door.

avatar image f4bo · Nov 26, 2014 at 11:31 AM 0
Share

look if the animation has "Loop Time" checked in the inspector

avatar image Fogsmoke · Nov 27, 2014 at 05:20 PM 0
Share

Thank you both for your timely responses.

Salmjak- I like your idea, but It seems this will put a bandaid on my problem. This is an asset that I would like to use repeatedly. I don't want to have to record an animation at each location. I am looking into the way I created the animation in Blender and exporting it using the Fbx exporter.

F4bo - I've tried with and without the "loop time" checked. Same result.

avatar image f4bo · Nov 27, 2014 at 08:23 PM 0
Share

maybe if you try to be more specific we could sort what it seems to be a really $$anonymous$$or issue - when you say "the door always resets its starting transform rotation to 0" do you mean it starts again the animation from the beginning or just as it was going back to frame 0 and then it stops there?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Baste · Nov 28, 2014 at 12:16 AM

So I'm guessing that your animation starts the door at 0 at time 0, and rotates it to something like 90 after a while. That's going to give the behaviour you're seeing - animations are not relative to the world unless you set that up.

So, the way you fix this is like this:

1: Set your door prefab as a child of an empty gameobject. Make sure that the centre of this gameobject is where you want your door to rotate around.

2: Move the animation to the parent gameobject.

3: Now, make sure that the parent always has a rotation of 0 when you place it in the scene, and then rotate only the child object.

This will make the child keep the rotation you placed it in, as it's the parent's rotation that's being animated. The child will only rotate because it's parent is rotating.

It would be a ton easier if you could use localrotation as a curve in the animations, but animations are sucky and not supported anymore, so this is what you've got to work with.

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

Answer by Johnoss · Dec 04, 2015 at 04:02 PM

I had the exact problem as you did when updated to newer version of Unity3D (boy, took me ages to figure out it was animator related) and you fix it by unchecking Apply Root Motion at related Animator component

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

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why is the animator not changing the position but only changing the rotation? 0 Answers

Cannot rotate GameObject from C# Animator attached 1 Answer

How to set Position and Rotation of character during a Read-only animation (in code perhaps?),Set Position and rotation during animation 0 Answers

Only animate rotation not position 1 Answer

Objects not always Spawning At Correct Location 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