Hello,
I am able to do animation but the problem I have is switching. If I use PlayExclusive. It tends to lose the animation and if I use Play the animation doesn’t repeat I thought maybe it is the weight but it’s not the case. I seems maybe I have the animations on the same layer and Urho3D might be getting confused.
I’m not sure.
Vivienne
       [code]
       
       AnimatedModel* objectNodemodel=objectNode->CreateComponent();
      
/// Add Animation Controller
objectNode->CreateComponent<AnimationController>();
/// Setup mesh and mesh details nodes and stactic models
if(gender<51)
{
       ///       Code for character 
    /// Add animation state
    Animation * IdleAnimation = new Animation(context_);
    IdleAnimation = cache->GetResource<Animation>("Resources/Models/standardbipedolianfemaleIdleAction.ani");
    objectNodemodel -> AddAnimationState(IdleAnimation);
    IdleAnimation -> SetAnimationName ("IdleAnimation");
    /// Add Walking Animation
    Animation * AddAnimation = new Animation(context_);
    AddAnimation = cache->GetResource<Animation>("Resources/Models/standardbipedolianFemaleWalkAction.ani");
    objectNodemodel -> AddAnimationState(AddAnimation);
    AddAnimation -> SetAnimationName ("WalkAnimation");
    /// Get Controller
    AnimationController * playermeshAnimationController1 = objectNode -> GetComponent<AnimationController>();
    /// Set Morph Weight
    playermeshAnimationController1-> SetWeight("IdleAnimation",1);
    playermeshAnimationController1-> SetTime("IdleAnimation",1.89753);
    playermeshAnimationController1-> SetWeight("WalkAnimation",1);
    playermeshAnimationController1-> SetTime("WalkAnimation",2.45833);
    playermeshAnimationController1->Play("IdleAnimation",0,1,0);[/code]
Code in FixedUpdate
       [code]    // Movement in four directions
       
       if (controls_.IsDown(CTRL_FORWARD|CTRL_BACK|CTRL_LEFT|CTRL_RIGHT))
       
       {
      
  /// code for controls
    /// If in air, allow control, but slower than when on ground
    body->ApplyImpulse(rot * moveDir * (softGrounded ? MOVE_FORCE : INAIR_MOVE_FORCE));
    animCtrl -> StopAll();
    animCtrl -> PlayExclusive("WalkAnimation", 0, true, 0);
}
else
{
    if(softGrounded)
    {
        if(!animCtrl->IsPlaying("IdleAnimation"))
        {
            animCtrl -> PlayExclusive("IdleAnimation", 0, true, 0);
        }
    }
}[/code] 
     
     
    