Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Neurus_Ex · Jun 22, 2017 at 08:21 PM · animationtransformanimations

Turning animation while player presses button.

All right, let's go with some super simple/silly questions:

I have this GameObject. This gameObject has an animator attached to it. It performs several things like making the gameObject spawn, despawn, and all that stuff.

In the middle of all of this, I have a "Idle" animation that keeps the object centered and with its original scale. The reasons behind the need of this animation are [still unknown to me][1].

My problem here is that I need to make the GameObject rotate when (and while) a user presses a button, and then make the object maintain that animation when the user stops pushing the button. So, I need to either:

1) Get how can I set the initial transform of a animation to a specific value.

2) Learn how to make the initial transform of a given animation be the current transform of the GameObject.

Maybe there's something wrong with my "idle animation approach" (as it fixes the idle state to a specific transform), but I haven't managed to get why or how. [1]: http://answers.unity3d.com/questions/1282458/behavior-of-empty-state-machines-and-idle-empty-an.html

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
0

Answer by theANMATOR2b · Jun 23, 2017 at 03:43 PM

Have you tried to parent the animated game object to an empty game object - and control the "turn" of that empty game object without having to mess with the original game objects animation parameters?

As long as the original game object is not being translated (moved) in space - I think this is the setup I would use. Also I don't think I would control spawn/de-spawn in the animator - but if it works for you - keep it. :)

Comment
Add comment · Show 1 · 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 Neurus_Ex · Jun 27, 2017 at 09:04 PM 1
Share

The parent animator idea is on the table, but the GameObject is a bit more complex that what I described. Creating another "layer" on the prefab would create additional headaches in the form of broken initializations and/or lost references. Also, the problem of keeping the turret turned would remain, right? Once you finish executing the animation, the animation state would return to "something" (which would be the "idle" animation), right?

"Also I don't think I would control spawn/de-spawn in the animator - but if it works for you - keep it. :) "

I meant "play the spawn/despawn" animations, hah. The actual spawn is controlled in code and is there where the trigger for the animations is fired.

I talked to a friend and gave me an idea, so I'm going to try creating a 360º turn animation for the idle state and setting its speed to zero, and the time to the angle turned. So if you press until the transform says it has turned 60º, when returning to "Idle State" the code tells the Animator to "play" Idle, with zero speed, starting at second 60.

Wish me luck!

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

168 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Lipsync with phonem animations? 0 Answers

Shooting animation playing for longer than a second? 1 Answer

Animation Continue 0 Answers

Animation Running Game 0 Answers

Unity Animator cant play the same animation twice. 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