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

Movement and amination

Discussion in 'Scripting' started by shaunluu, Jan 20, 2019.

  1. shaunluu

    shaunluu

    Joined:
    Jan 20, 2019
    Posts:
    1
    Hello! Sry about my english, I will try my best.
    I trying to make character controller with animations.
    I stuck with adding "Sprint-to-rotate180" because character start moving instantly; he didnt feel inertia
    How can i realise it ?
    Only one thing that comes in my head - is freez input, play anim , unfreezuput;
    i think this is realy bad realisation.

    i have "Sprint to Stop" and it have same problem. It can be much better if character cant move about 0,1 sek after release move button.
    This is my project .rar. You can look at it and play with character.
    http://s000.tinyupload.com/index.php?file_id=97975408499791370636
    btw :1) is my realisation of checking movement of character correct ?
    Code (CSharp):
    1.  isMoving = (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)) ? true : false;
    2.         isSprinting = (Input.GetKey(KeyCode.LeftShift)) ? true : false;
    2) how i can make to gain speed smooth, not like i did
    Code (CSharp):
    1.  Speed = (isSprinting) ? 8 : 5 ;
    with Lerp ?

    3) As you can see in my project - changing animation from Run to Sprint by pressing Shift sometime looks not good. I think it happed because animation starting with another leg.
    I think it can be solved by reycasting line from leg into floor. and mirroring animation from data.
    But maybe it have some less resourse solution ?

    Thank for helping, and big sry about my english. i really tryed.
     
    Last edited: Jan 20, 2019