Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. 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
  8. 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:
    4
    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,096
    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.
     
    goldleafboy and theANMATOR2b like this.
  3. goldleafboy

    goldleafboy

    Joined:
    May 13, 2018
    Posts:
    4
    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,772
    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.
     
    goldleafboy and MD_Reptile like this.
  5. goldleafboy

    goldleafboy

    Joined:
    May 13, 2018
    Posts:
    4
    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,096
    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!
     
    goldleafboy and theANMATOR2b like this.
  7. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    150
    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:
     
    goldleafboy and theANMATOR2b like this.
  8. goldleafboy

    goldleafboy

    Joined:
    May 13, 2018
    Posts:
    4
    Today I accidently clicked on this link from my history, and Woo! there are more replies. And I feel sorry for not replying to you guys!
    Actually I had abandoned the dino project, because I couldn't figure it out.

    But now I can give it a try, thanks to you awesome people!
    So yeah, tomorrow I’ll do that when I’m at my computer.

    Good day!:):D
     
    MD_Reptile likes this.