Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Make a character walk

Discussion in 'Getting Started' started by warrenbrandt, Mar 19, 2018.

  1. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    ok ok i admit defeat...a flight game is way out of my league...at the moment

    i thought i would try something a bit simpler
    im just trying to get my animated hitman to walk around the country side.
    and this too is proving to be quite difficult

    anyway i down loaded this asset from Yurowm characters
    its a hitman

    but i just dont know how to get the character walking around...the manual is very limited

    i was following a tutorial on moving an animated character and made this script

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class MoveSoldier : MonoBehaviour
    {

    private float speed = 0.2f;
    public float wspeed;
    public float rspeed;
    public float rotspeed;

    void update()
    {
    var z = Input.GetAxis("Horizontal") * speed;
    var y = Input.GetAxis("vertical") * rotspeed;

    transform.Translate(0, 0, z);
    transform.Rotate(0, y, 0);
    }
    }

    and attached it to my hitman character,but he doesnt walk
    what am i missing?

    any ideas appreciated,any tutorials you think i should watch please tell me
     
  2. Ceciphar

    Ceciphar

    Joined:
    Jan 21, 2017
    Posts:
    51
    "transform.Translate(0, 0, z);
    transform.Rotate(0, y, 0);"

    What is this doing?
    How is your axis responding to transform.Translate?

    I know the logic but I'm still a beginner

    If I'm wrong please let me know.
     
    Last edited: Mar 20, 2018
  3. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    657
    First... code tags. :)

    Second, what do you mean he doesn't "walk".

    He doesn't move, at all?

    Or doesnt walk "animated"?

    Often, it is best to have an empty game object as the parent transform to the character model. This way you can move around the object without inadvertenly affecting the animation scale rotation etc.
     
  4. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    hi he doesnt move at all...i applied another script now he moves but not animated
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I'm fairly certain all this (including making a character walk, run, and jump) is covered in the tutorials. Wouldn't it be faster to snuggle up to those for a few weeks, than try to figure out everything on your own or through Q&A?
     
  6. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    657
    Characters / models wont just be imported and magically start running around enchanted by some fairy crafted spell.

    Theres much to do between writing code to move and monitor states, and implementing imported animations / fbx.

    I agree with JoeStrout... if youre this new those tutorials are highly recommended.

    I also have a discord server for chattin and helpin with unity.

    https://discord.gg/24m8GG

    Find me there if you need more help and exhaust your options. But trust me, you have many options to learn
     
    Ryiah likes this.
  7. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    Where are good tutorials the ones on unity Web site seem out dated and have update pdfs for unity 17 seems like a lot of extra work to learn an old tutorial then have to follow a pdf to amend the changes...im quite surprised the site isn't more up to date.. Where is the best tutorials or place to learn?
     
  8. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    Oh and thanks homicide really appreciate that
     
  9. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Dude! You've been told several times to start with the tutorials under the 'Learn' link. Yes, some are old, but not that old. Yes, many have been patched but not all. For the last year Unity has been making an incredible amount of changes, both in depth and breath. Sadly the tutorials are the last to get revised. It's very difficult to stay current as Unity is a moving target. I myself, and I'll bet many others are simply overwhelmed over the vast number changes Unity has made. I choose to continue my projects and ignore all the new features. I'll incorporate the new when necessary or appropriate.

    If you looking at old tutorials, download the corresponding Unity version, all old versions are available to you. The basic principles, that you don't seem to grasp now, have not changed since the first version. The tutorials teach you how to build small complete projects. They allow you to take those projects and make them your own by modifying the completed projects. Along the way you will learn to use the Editor, MonoDevelop/VisualStudio, write C# code, build and publish a game. You've got a lot to learn, stop putzing around and just start the tuts.

    If your interested, as I'm writing this now, there is a Unity Keynote screen cast going on right now. They will be laying out the big rollout of changes and improvements for the next year. The fact that Unity is making such an effort to improve it's product is a sign you trust Unity to be around when you've finally start making the games you want to.
     
    Ceciphar and JoeStrout like this.
  10. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Also please use Code Tags when posting code. It's so much easier to read.
     
    warrenbrandt likes this.
  11. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    https://unity3d.com/learn
     
  12. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    OK guys really thanks for all the input... Yes I agree .. Tuts it is... Speak soon
     
    JoeStrout likes this.
  13. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    ok ok ok i am happy to be wrong...doing the space shooter tutorial ...really fantastic have learned so much!!! i was trying to fly before i could walk (no pun intended) thanks for all your input,speak again when im more proficient

    oh one quick question...is or should the player object weather its first person third whatever position always be set to origin?

    hooked...
     
    DerrickMoore, JoeStrout and Vryken like this.
  14. Ceciphar

    Ceciphar

    Joined:
    Jan 21, 2017
    Posts:
    51
    Good luck
     
  15. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    It isn't necessary, because all that does is just set the game object's position & rotation to 0 all across.
    It is recommended however because it's just cleaner to work with instead of having random values when you first create an object.
     
  16. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    When adding objects to a scene or the hierarchy it is really not necessary. You're going to place those objects around the scene and probably not at origin. If your placing an object as a child it probably should be zeroed out. There are times you may want a child offset from the parent origin or rotated, but those are special circumstances. The transform pane has a gear icon and just know if you need to zero out use the 'Reset' option.

    Keep up the good work.
     
  17. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181

    @warrenbrandt , I feel confident that nothing I say will diminish your unbridled enthusiasm, so I'll be the bad guy and suggest that you leave some room on the internet for other newbies to ask questions too.

    But don't observe a modicum of silence for anybody else's sake alone -- what good did selflessness ever do anybody? -- do it for your own sake.

    Think about it. You want to be a programmer. A game maker. Yet you seem to attack minor problems not by trying to understand them, but by calling attack dogs, and before the viscous hounds can mangle your foe you've wandered off, finding something else for them to kill.

    Well, I don't think you should abuse innocence. I know you don't mean to be evil, but you should practice focusing on problems, no matter how insignificant they are, and making a firm resolution to resolve them on your own and only call the dogs when all options have been truly exhausted.


    *dogs is not a derogatory metaphor.
     
    warrenbrandt likes this.
  18. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    "Think about it. You want to be a programmer. A game maker. Yet you seem to attack minor problems not by trying to understand them, but by calling attack dogs, and before the viscous hounds can mangle your foe you've wandered off, finding something else for them to kill." ...what drugs are you on?,can i please have some!!!

    oh well i guess there is one in every forum...
     
    Last edited: Mar 26, 2018
  19. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
  20. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    havent you got somewhere else to be?
     
  21. NiniChan90

    NiniChan90

    Joined:
    Apr 10, 2022
    Posts:
    1
    Bruh why are forums so rude to newbies?