Search Unity

Animated prefab x.y,z location co-ordinates won't change in scene

Discussion in 'Animation' started by Patrk, May 26, 2017.

  1. Patrk

    Patrk

    Joined:
    Apr 9, 2017
    Posts:
    48
    Hi,
    I have imported a few 3D objects from blender into a scene in Unity, onto a terrain or plane and I can position them easily by changing the x, y and z positions in the inspector.

    But when I import animated 3D object and then segment and bring into Mecanim and create a prefab, and then when I drag the prefab to the scene and then change the x, y and z positions in the inspector, the animation doesn’t change position when I test it. I’m thinking that mecanim stops it moving, or it defaults to the co-ordinates its been saved out from blender at? Any help appreciated?



    thanks

    P
     
  2. cstooch

    cstooch

    Joined:
    Apr 16, 2014
    Posts:
    354
    First off, am I understanding correctly that your animation itself should be moving the object? And your object is animating fine, it's just that the object isn't moving? If so....

    Make sure Apply Root Motion is checked on your Animator component on your object. In addition the actual animation has some checkboxes and such that may be overriding the root motion. It's explained here better than I could possibly explain it:

    https://docs.unity3d.com/Manual/RootMotion.html

    But I'd suspect you don't have Apply Root Motion checked.


    I'm probably completely misunderstanding your question though.. if so, sorry! if you mean that the object isn't even animating, that's a whole other issue. You'd want to read up more on how animations work, but basically you need a way to trigger a transition to whatever state (ex. running) you're looking for. Just moving your object around won't automatically tell your animation it needs to do some movement animation, for example.
     
    Last edited: May 26, 2017
  3. Patrk

    Patrk

    Joined:
    Apr 9, 2017
    Posts:
    48
    hi, no my object is animating alright, its simply a spinning object animated in blender and then brought into unity, i've segmented it and added an animator contoller then created a prefab and dragged into into the scene, so its using animator not unity animation. it animates fine...when I drag a regular object into a unity scene I can change the objects scale and location co-ordinates in the inspectors tranform panel....but when I click on an animated object in the scene and change the scale and co-ordinates ...when played it stays as it was before...wheeras the regular object changes...and idea?
     
  4. Patrk

    Patrk

    Joined:
    Apr 9, 2017
    Posts:
    48
    when I apply root-motion to the prefab I can change the animations location on the sphere but...it stops spinning..
     
  5. ratxrat

    ratxrat

    Joined:
    Nov 7, 2016
    Posts:
    19
    just make child your animation object to empty game object that make coord local , if your animation object is not child that use global coord
     
    HappyAviala likes this.
  6. Patrk

    Patrk

    Joined:
    Apr 9, 2017
    Posts:
    48
    ok thanks that works, the prefab as local child of the empty game object animates where the empty game object is positioned. If I want to have the same instance of the prefab but in different locations, and maybe different scale do I have to create a new empty game object each time or is there a way around this?
     
  7. Patrk

    Patrk

    Joined:
    Apr 9, 2017
    Posts:
    48
    and when u do use the same prefab as a different instance in another empty game object the prefab doesn't animate, so I reckon I will have to create another prefab and animator for each animation...