void StateCharacterTurning::Update(float timeStep)
{
	StateCharacterGrounded::Update();
	
	RigidBody* body = pawn_->GetBody();
	AnimationController* animCtrl = static_cast<PawnAnimated*>(pawn_)->GetAnimationController();

	//apply a force to slow it down further, since we are changing direction
	body->ApplyImpulse(moveDir_ * pawn_->GetMoveForce() *0.25);//0.25 to dampen it

    //get the speed that we are travelling, that will determine when we turn around
    if(!flipped_)
    {
        //before we are flipped around, we drive the turning animation
        //float spd = pawn_->GetPlaneVelocity().Length();
        //float turnTime = Fit(spd,0.0f,speed_,1.0f,0.0f);
        
        animCtrl->PlayExclusive("Models/Man/MAN_TurnSkidGunning.ani", 0,false, 0.1f);
        //animCtrl->SetTime("Models/Man/MAN_TurnSkidGunning.ani",turnTime);

        if(animCtrl->IsAtEnd("Models/Man/MAN_TurnSkidGunning.ani"))
        {
            Turn();
            animCtrl->Play("Models/Man/MAN_TurnSkidGunningFlipped.ani", false, 0.0f);
            flipped_=true;
        }
    }
    else
    {
        animCtrl->Play("Models/Man/MAN_TurnSkidGunningFlipped.ani", false, 0.0f);
        //now that we are flipped we can set it to the next state too
        pawn_->SetState( new StateCharacterRunning(context_) );
    }
}