Search Unity

Animation tweaking

Discussion in 'Animation' started by ManAmazin, Oct 27, 2013.

  1. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    ok so i got my animation to work with my touch screen buttons finally! lol so my character runs left and right and idle,,,my problem is when running left and right he run at an angle more so turning right..i want him to just run left or run right preferably on the x -axis is the possible to do?
     
  2. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    anyone?
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,687
    Can you provide more details? Are you using Mecanim or legacy? By running left and right, do you mean strafing (side-stepping), or rotating 90 degrees and running "forward" in the new local orientation?
     
  4. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246

    im using mecanim rotating and running forward would be more ideal as strafing would look robotic to me for this situation
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,687
    Are you using turning animations (like in the Locomotion Starter Kit), or manually rotating the transform?

    If you're using turning animations, here's one solution:

    1. If you have a locomotion blend tree that includes running forward and turning, remove it.

    2. Create a state machine with three clip states:
    • RunForward: plays the run forward animation
    • TurnLeft: plays an exact 90-degree left turn
    • TurnRight: plays an exact 90-degree right turn
    3. When it's time to turn left, just transition from RunForward to TurnLeft. Make sure it's atomic and runs all the way to the end to guarantee that TurnLeft does the full 90 degrees. At the end (exit time), transition back to RunForward.

    4. Same for turning right.


    If you're manually rotating the transform, just make sure to rotate it exactly 90 degrees, perhaps in a coroutine.
     
    theANMATOR2b likes this.
  6. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    ok i see what your doing there but maybe i have to import new animations because the ones that came with the character are part of a running animation and inside the animation is run left and run right so he is running and turning at the same time does the locomotion starter kit have what you are suggesting?
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,687
    You could always download the Locomotion Starter Kit to check for yourself. It's free. :)

    Anyway, animations in the starter kit also run while turning. That shouldn't be a problem, though, if you use the state machine I suggested in my previous reply.
     
  8. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    now how my game is set up its like a 2D structure in 3D enviroment(obviously lol) the character can hold Idle, run left or run right and back to idle when stopping or changing position..if he is to run forward he would be running towards the camera and i dont want that ya see? now i messing with what you said in previous previous post but thought id throw that out there seeing if you had insight on that
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,687
  10. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    i actually got it how i want it now i meant to write this last night lol...ok so on the final note of this how do i add speed to the animation ive tried adding force, using a float variable but maybe my placement is wrong cause he still move some one slow
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,687
    Since you're using Mecanim and presumably root motion, increase the state's Speed. Or, to get more sophisticated, create a blend tree with the same animation at different speeds, and blend between them on a float parameter.
     
    theANMATOR2b likes this.
  12. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246

    Thanks So much man i really appreciate your help!
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,687
    Happy to help!
     
  14. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    ok ok i lied lol when i mentioned speed i dont want my animation to be faster per se but when the character run left or right im looking for him to move faster IN that direction
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,687
    If you're using root animation, you need to edit the original animation so it moves faster. If you're scripting motion (e.g., CharacterController.Move()), then you just need to increase the offset. Check out that tutorial series for more help.