Original Blender character faces ground when not walking

Right! Problem(s) solved. Updated (solution) code

and original confused floundering preserved below.

Poster Competence: Complete noob.

The Objective: Character moves and animates in 3D space (scripts below) and when motionless (with no input) stands still (upright) and plays an idle animation.

The Result: Character moves and animates in 3D space and when motionless ROTATES 90 DEGREES AND FLOATS ABOUT A METRE OFF THE GROUND, FACING THE GROUND while playing idle animation. Moving returns character to correct orientation (hurrah), ceasing movement returns character to 90 degree state (boo). (Short answer - gravity value was increasing the downward direction variable from 0, causing the SetLookRotation command to aim the character at the ground)

Summary: what the hell I don't even

Character is skinned and animated with location and rotation information applied before saving in Blender. Character was rescaled SLIGHTLY in Unity.

Motion/Animation scripts derived from the following: http://unity3d.com/support/documentation/ScriptReference/CharacterController.Move.html http://unity3d.com/support/documentation/Manual/Character-Animation.html

Movement Script (SOLVED!):

/// This script moves the character controller forward 
/// and sideways based on the arrow keys.
/// It also jumps when pressing space.
/// Make sure to attach a character controller to the same game object.
/// It is recommended that you make only one call to Move or SimpleMove per frame.    

var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;

private var moveDirection : Vector3 = Vector3.zero;

function Update() {
    var controller : CharacterController = GetComponent(CharacterController);
    if (controller.isGrounded) {
        // We are grounded, so recalculate
        // move direction directly from axes
        moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,
                                Input.GetAxis("Vertical"));

        moveDirection *= speed;

        if (Input.GetButton ("Jump")) {
            moveDirection.y = jumpSpeed;
        }
    }

    // Move the controller
    controller.Move(moveDirection * Time.deltaTime);

// Owen Reynolds change --> Copies moveDirection to moveOrientation and sets Y to 0.
// Awesome.
    if (moveDirection.x !=0 || moveDirection.z !=0) 
    {
        var moveOrientation : Vector3 = moveDirection;
        moveOrientation.y = 0;
        var rotation = transform.rotation; 
        rotation.SetLookRotation(moveOrientation); 
        transform.rotation = rotation;
    }

    // Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;
}

Animation Script (SOLVED!):

    function Start ()
    {
        //Set all animations to loop
        animation.wrapMode = WrapMode.Loop;
        // except using
        animation["revEdaStandAction"].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["revEdaWalk01"].layer = 1;
        animation["revEdaStandAction"].layer = 2;

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

    function Update ()
    {   
        if(Input.GetAxis ("Horizontal") !=0 || Input.GetAxis ("Vertical") !=0)
        {
            animation.CrossFade ("revEdaWalk01");
            //Debug.Log("GetAxis is !0");
        }

    // Still ended up using two Walk 'if's as character continued to walk while motionless.
    // The following checks that character is motionless on x&z, STOPS the walk anim & plays
    // the anim revEdaIdle. Need to investigate blends...!
        if(Input.GetAxis ("Horizontal") ==0 && Input.GetAxis ("Vertical") == 0)
        {
            animation.Stop("revEdaWalk01");
            animation.CrossFade ("revEdaIdle01");
            //Debug.Log("GetAxis is 0");
        }

        // Using
        if(Input.GetButtonUp ("Fire1"))
        {
            animation.CrossFade ("revEdaStandAction");
        }
}

Character game object has Transform, Animation, Character Controller and the two scripts above attached.

There are a few Unity Answers posts & Unity Forum posts which seem kinda close to what I'm asking, but try as I might I haven't been able to extract a solution to my problem. The closest thing to a solution I've found is a suggestion to flip the character z and y axis in Blender and, really...'really?' In Unity? In a program user-friendly thus far? (Not an issue)

Looking forward to upvoting a helpful answer. Thanks, guys. =) (GOT ONE! Cheers, Owen!)

I think the problem is the SetLookRotation (bottom of 1st code block.) You are always moving a tiny bit down due to gravity. If you are stopped, you count as moving straight down. If you are coasting to a stop, you count as moving 45 degrees down.

You probably want to ignore your y-speed completely. Of course, you can't get rid of gravity or really mess with ySpeed, or else you will never come down from a jump. I'd try:

if(md.x!=0 || md.z!=0) { // not moving on flat map. We could be jumping up, Who cares.
  // Use COPY of moveDirection, with y gone:
  Vector3 md = movedirection; 
  md.y = 0;
  blah, blah SetLookRotation(md); // look in the FLAT way we are moving
}

The fact your Walk looks OK sort of proves you have the export axis' sorted out. I had to use the blender FBX exporter explicitly, and there is a button that says "FlipY/-Z" (takes care of Meltdown's comment about wrong axis.)

There's a small bug in your animation code: if you aren't moving sideways, you idle. Maybe combine the two Walk ifs:

if(horiz!=0 || vert!=0) walk
else idle

check out this link

http://answers.unity3d.com/questions/692807/how-to-make-character-run-along-a-slope-road-in-un.html