Search Unity

Animation not working on an instantiated prefab (weapon)

Discussion in 'Animation' started by Vazili_KZ, Aug 26, 2019.

  1. Vazili_KZ

    Vazili_KZ

    Joined:
    Sep 18, 2016
    Posts:
    25
    Hello guys,
    So i'm working on this project and i'm using it to finally learn how to animate in 3D (taking a small break from coding hehe)
    So here i am faced with a problem and i have no idea what i did wrong. First let me explain how everything works.

    So the Animator is attached to the player, and the player obviously has a structure of legs arms...etc
    everything inside the player is being animated by this animator.
    So i have a weapon (a wooden sword) that has it's pivot attached to it's bottom (in case it helps to know)
    i'm animating it from that pivot point, which happens to be the parent to which the sword model is a child to.
    When i hit the V key the weapon gets instantiated in the player's hand (which is an empty gameobject) and when i press the F key the player attack and activates a trigger in the animation that starts the attack animation.

    But the animation is not working properly. more precisely the key frames of the weapon are not being player(as you can see in the video all the rotation axes give the coordinates of 0 0 0 throughout all the animation.
    But, ...and this is where the strange things start!... when i manually go through each second to play the animation and see what's happening, you can see that those coordinates start to change and it shows the animation exactly as it's supposed to be. then when i switch back to idle state so that i can start moving around the player normally. when i hit the F key to attack the correct animation is player and no problem happens... Magic? i don't think so... :p

    what do you think? what could be causing this problem.
    Who's up to solve my riddle :cool:
    Seriously guys what's going on here, i need help.o_O
    Thank you all ;)

    The Video :
     
    Last edited: Aug 26, 2019