Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
  • Help Room /
avatar image
1
Question by maximilianFromJpn · Jan 27, 2012 at 02:14 PM · animationrotationquaternion

Can I control object rotation on playing animation?

Can I control object rotation on playing animation?

I've always been thinking that affected animation node does not control.

Was I wrong?

the node is playing animation now. however I was able to modify parameter by following this code.

 function Update() {
     transform.rotation = 
         Quaternion.Euler( defaultEuler.x + x, defaultEuler.y + y, defaultEuler.z + z );
 }

I tried made a same situation by using easy object(cube premitive object).

But object does not move. Parameter follows animation.

I'm not sure this cause.

and, Object that I can control rotation on playing animation does not move by using this code.

 function Update()
 {
     transform.rotation = Quaternion.Slerp( 
         transform.rotation,
         Quaternion.Euler( defaultEuler.x + x, defaultEuler.y + y, defaultEuler.z + z),
         Time.deltaTime * chaseCameraSpeed );
 }

Object state that shaking slightly(Brr). I'm not sure really...

Can I control object that affected by playing animation?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Owen-Reynolds · Jan 27, 2012 at 04:40 PM

Your English is a little weak, but I think adequate. The question needs more details about the set-up.

Most animations were created in a modelling program, on bones. Since you're talking about a Cube, I'm guessing that you created the animation using Unity's animation window, and added it to the Cube, as a Component.

Animations fully control the rotation/transform of the object they are on. They run after Update (and before LateUpdate,) so they override your Update code. The trick is to animate the child and code-move the parent:

 square <- empty game object. Update script can move this
   Cube <- cube made in Unity. Has animation component
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 maximilianFromJpn · Jan 28, 2012 at 02:51 PM 0
Share

Thanks for the answer.

sorry, I am studying English little by little.

I didn't know that animation update moment.

I think that this problem is diffrent of update method I call.

I could change rotation of object on playing animation using LateUpdate method.

Thank you so much.

avatar image
0

Answer by duc · Feb 17, 2012 at 02:17 AM

hey, i want the animation of the cube which is a simple rotate to be played only when i clic on left mouse! how can i do that ? help please and thank you

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 Pau678 · Dec 01, 2018 at 01:01 PM

    public animation anim;
 
 
  if (Input.GetMouseButtonDown(1))
         {
             anim.Play("NameOfTheAnimation");
         }

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

Adding/Subtracting Rotation Data 0 Answers

how can I change the interpolation type of animationclip's rotation property 1 Answer

Animation Position Shifting Player Controller Down 1 Answer

Need Help With Having Enemy Arms Pointed at Player 1 Answer

Odd twitching when using deltaTime 1 Answer


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