Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

NooB-Q

Discussion in 'Community Learning & Teaching' started by Fenster, Jan 19, 2008.

  1. Fenster

    Fenster

    Joined:
    Jan 19, 2008
    Posts:
    1
    Hello community...
    I have am trying to do something but am realy stuck, and I think it's just something that I miss.

    I wrote this script, from the manual:

    function Start ()
    {
    // Set all animations to loop
    animation.wrapMode = WrapMode.Loop;
    // except shooting
    animation["grab"].wrapMode = WrapMode.Once;

    // Put idle and walk into lower layers (The default layer is always 0)
    // This will do two things
    // - Since shoot and idle/walk are in different layers they will not affect
    // each other's playback when calling CrossFade.
    // - Since shoot is in a higher layer, the animation will replace idle/walk
    // animations when faded in.
    animation["grab"].layer = 1;

    // Stop animations that are already playing
    //(In case user forgot to disable play automatically)
    animation.Stop();
    }

    function Update () {
    // Based on the key that is pressed,
    // play the walk animation or the idle animation
    if (Mathf.Abs(Input.GetAxis("Vertical")) > 0.1)
    animation.CrossFade("walk");


    else
    animation.CrossFade("idle0");

    // Shoot
    if (Input.GetButtonDown ("Fire1"))
    animation.CrossFade("grab");
    }

    It relates to a character I imported with Maya. It grabs, it stands idly and it walks - but only Vertical (i.e W and S) when I want him to move sideways - it glides (!). I tried putting "Horizontal" to the input - and then it moves only horizontally - what's with that?