Search Unity

exchange the player?

Discussion in 'Animation' started by grka, Jan 27, 2015.

  1. grka

    grka

    Joined:
    Jan 14, 2015
    Posts:
    80
    I hope this is the right forum. I have downloaded a game framework which contains a Player (third Person object) which walks around the game world when the user uses the cursor keys. Now I would like to keep that player but exchange his optics. How can this be done? I got a 3D figure from the asset store and just added als scripts from the old player. This Person is reacting to the cursor keys and can be moved around that way but it doesn't move any arm or leg in that case.... What do I have to do to make the new figure moving the arms and legs like the old one?
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,688
    Watch the animation tutorials, in particular "4. Humanoid Avatars" (but watch 1-3 first so it makes sense). Then watch the last one, "Character to Player". As long as your framework uses Mecanim (versus the old legacy animation system), you can apply the same animations to your replacement model. This process is called retargeting.
     
  3. grka

    grka

    Joined:
    Jan 14, 2015
    Posts:
    80
    I hope you can help me to understand where my problem is.

    I instanciated my new character and added the same Animator Controller, Character Controler and Script to it. I also named my new object the same way then the old was. I deleted the old one.

    Then I opened the animations of the old character model. When I click on them I can see in the inspector->animations a character and when I hit the play button this character is moving. Now I clicked on Rig and changed the Avatar to my new character. When I went back to inspector->animations and hit the play button I could see my new avatar moving as the old one.

    But when I start my game then my new character is not moving around like just in the preview. I checked in the Animator if the motion is set correct for e.g. Idle state and yes it is connected to the animation that I just changed.

    I guess that somewhere I have to change something more but I have no idea where.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,688
    Can you post screenshots of the inspector for the old (working) character and your new character?
     
  5. grka

    grka

    Joined:
    Jan 14, 2015
    Posts:
    80
    Ok I made some screenshot

    This is the old Character:


    this is the new one:


    this is one of the old animations


    and here you can see the new character in the same animation:


    In this small preview the model is moving its body as expected but in the game itself it like a frozen body that is pushed around when I hit the cursor keys
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,688
    Are they both imported as Humanoid? (Not Generic)

    Select your character in the Scene view. Then open the Animation view. In the Animation view, select the animation in the pop-up menu and press the play button. Does your character play the animation in the Scene view?
     
  7. grka

    grka

    Joined:
    Jan 14, 2015
    Posts:
    80
    Sorry I don't understand completely where to click.. I selected my character in the Scene View but how can I open the Animation view? Is this the Animator? If yes, there is no pop up...

    Or do you mean windows->animation? When I click play there then the character isn't moving in the scene view

    Yes both characters are selected as humanoid
     
    Last edited: Jan 28, 2015
  8. grka

    grka

    Joined:
    Jan 14, 2015
    Posts:
    80
    I found my problem :) One of the child elements from the new character was accidently renamed :)
     
    theANMATOR2b likes this.
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,688
    Glad you found it! :)