Search Unity

Animator Causes Rotation

Discussion in 'Animation' started by GramboGames, Mar 2, 2015.

  1. GramboGames

    GramboGames

    Joined:
    Jan 7, 2013
    Posts:
    5
    Hello!

    Straight to the point, I instantiate a projectile while looking a direction and the projectile has a script that tells itself to move forward. However, once an "Animator" component is added, all instantiated projectiles are rotated to look at the negative z axis, and therefore, all shoot in the negative z direction.

    My question is, how would adding an Animator component cause a change in rotation?

    PS: I've tested with disabling and enabling the Animator, it is definitely this component.
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    It hard to tell without the project.

    The Animator component doesn't rotate object without a good reason, you probably have some root motion curve.
    Can you try to uncheck Animator.applyRootMotion to see if it change something?

    Also why do you want an Animator component on a projectiles. Most of the time you simply use a rigid body to simulate the projectile trajectory.
     
  3. GramboGames

    GramboGames

    Joined:
    Jan 7, 2013
    Posts:
    5
    Thank you for the reply!

    I have tried unchecking Apply Root Motion and I still receive the same problem.

    I can upload my project if that would help you locate the problem.

    I have the particles spinning, and intend to have magic blob looking projectiles that will also animate in the future.

    If there is a better way to do this, I'd be willing to switch to it as well. The projectiles will only have one animation each, so should I simply allow the animation to be called by a Script without an Animator component?
     
    Last edited: Mar 3, 2015
  4. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    What kind of animation you would like to do? If it only particules there no need to add an animator component to have animated particules

    If you have an animation clip then you don't have the choice you need either a Animation or Animator component to play an animation clip.
     
  5. GramboGames

    GramboGames

    Joined:
    Jan 7, 2013
    Posts:
    5
  6. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    That look like a blend shape,
    so in this case you will need an Animator component to animate the blend shape.
     
    theANMATOR2b likes this.
  7. GramboGames

    GramboGames

    Joined:
    Jan 7, 2013
    Posts:
    5
    Okay, so were back to the Animator changing the projectile's direction.

    Anything you can suggest testing, to find the problem?

    So far:
    A have an instantiated projectile that is given a rotation, Instantiate(prefab, transform.position, transform.rotation)
    I have isolated that it is happening only when an enabled animator component is on the object.
    I've checked and unchecked the apply root motion, with no change occurring.
     
  8. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Can you log a bug with your project so I can take a look.

    Send me you case number when you get it.
     
  9. GramboGames

    GramboGames

    Joined:
    Jan 7, 2013
    Posts:
    5
  10. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Was this bug cleared or solution found?