Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Make Animal walk cycle to move forward. (also explained in a video)

Discussion in 'Animation' started by goldleafboy, May 14, 2018.

  1. goldleafboy

    goldleafboy

    Joined:
    May 13, 2018
    Posts:
    3
    Good morning people!

    I make animation videos and recently I discovered unity, I like being able to mix, and create transitions between animations in the timeline.
    so here I'm trying to make a video, where a Dinosaur is running and Cinemachine Camera is following it.

    The run cycle I downloaded is animated in the center of the world it does not move forward. So how can I make it go forward. It's just for a video, not for a game.
    Do I need to setup any controller for this?

    I'm stuck on this problem since 2 days. I need a tiny little help here.

    God bless, thank you!

    I explained this in a quick video, you can watch here.
     
  2. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,062
    I'm not totally sure what you might do to have it animate without running the game (hitting play in the editor), but anyway you could just attach a simple script to the gameobject of the dino, and have it do Transform.Translate to move the object forwards at a certain speed, and have the camera either "lock on" with some camera script, or as a child object of the dino, so it moves with it.
     
    theANMATOR2b likes this.
  3. goldleafboy

    goldleafboy

    Joined:
    May 13, 2018
    Posts:
    3
    God I'm really happy that you replied @MD_Reptile!

    So when I said "Its just for a video, not for a game" I meant I'm just using unity to render animations for my video projects not for making games:). Anyways.

    So here all I want is, to make this dino go forward, which you already addressed. And I'm gonna try this, correct me if I'm wrong. Could you also tell me what values do I have to change, I'm not very familiar with scripting.

    1. Create a new C# script in project panel with this code.

    using UnityEngine;
    using System.Collections;

    public class ExampleClass : MonoBehaviour {
    void Update() {
    transform.Translate(0, 0, Time.deltaTime);
    transform.Translate(0, Time.deltaTime, 0, Space.World);
    }
    }



    2. Then select dino and, go to inspector window and add script.

    3. Hit play and dinosaur will walk forward?o_O




    Thank you for your time man!
     
    Last edited: May 14, 2018
    MD_Reptile likes this.
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,670
    If the script doesn't work you can research generating root motion in the documentation. Might help - though I don't know how it works on a rigged character.
    Since this character is animated in-place - parenting the root node to a empty game object that has generated root motion on it should work for your needs.
     
    MD_Reptile likes this.
  5. goldleafboy

    goldleafboy

    Joined:
    May 13, 2018
    Posts:
    3
    Thanks alot for replying:). So now I know this is to be done with programing which I did not know before. And I already have started taking a course in C# language!

    Good day!
     
  6. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,062
    This is what you might name "MoveDino.cs" (although you can't see filetypes in the editor, I just say that to clarify that your scripts name as well as the name of the class in the file must match) and is basically the same thing you posted before with the name change:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class MoveDino : MonoBehaviour
    5. {
    6.     void Update()
    7.     {
    8.         transform.Translate(0, 0, Time.deltaTime);
    9.         // this would add the delta time each frame to the z position of the object this script is attached to
    10.     }
    11. }
    With this, you should be able to get it going forward, but you should learn about (if you don't already know) what delta time is, so you understand why its working.

    Let us know if you hit any more problems! Good luck!
     
    theANMATOR2b likes this.
  7. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    147
    It's a root motion thing. Btw, you can use free version of a tool called "UMotion" from Asset Store to animate your characters inside Unity editor, and there is also a tutorial about using Root motion:
     
    theANMATOR2b likes this.