Jump to content
Sign in to follow this  
duda123

Weapon Switching Animation Problem

Recommended Posts

Been playing around with weapon switching, but have run into an issue.

 

Anyone know what's causing this:

 

When I use the cfg below and then do (player switchAction "TestSwitchAction"), the player is put into a standing up state with rifle lowered (AmovPercMstpSlowWrflDnon). When switching to pistol via action menu, the animation works correctly and is switched to a pistol standing up state (AmovPercMstpSrasWpstDnon).

 

Now, here's the problem:

 

If I uncomment the ConnectTo lines below, the transition to the pistol standing up state no longer works. It gets stuck in some sort of loop, flashing back and forth between the rifle and pistol states. Even if I take the original ConnectTo as defined on the AmovPercMstpSlowWrflDnon class and put into the StartingRifleDownState class below, it still has the same issue. Why would overriding the ConnectTo attribute (with the exact same value as defined in it's parent class) cause the weapon switching transition to break?

 



class CfgMovesBasic
{
    class ManActions
    {
        TestSwitchAction="StartingRifleDownState";    
                                
    };
    class Actions
    {
        class NoActions;
        class SwitchWeaponActions : NoActions
        {
            HandGunOn="AmovPercMstpSrasWpstDnon";
        };
    };
};


class CfgMovesMaleSdr: CfgMovesBasic
{
    class States
    {
        class AmovPercMstpSlowWrflDnon;
        class StartingRifleDownState : AmovPercMstpSlowWrflDnon
        {
            actions="SwitchWeaponActions";
            //ConnectTo[]= {
            //    "AmovPercMstpSrasWpstDnon", 0.1
            //};            
        };
    };
};


Here's a video of what happens when you uncomment ConnectTo:

 


 

FYI - I run into the same problem when using custom animations as well.

Share this post


Link to post
Share on other sites

Spent some more time trying to debug this. I'm still stumped. Any time I override the ConnectTo, it gets stuck in the transition.

 

There's gotta be something I'm missing... anyone?

Share this post


Link to post
Share on other sites

please describe what exactly you want to achieve with that new animation. easier to see what's going on that way.

Share this post


Link to post
Share on other sites

please describe what exactly you want to achieve with that new animation. easier to see what's going on that way.

I would like to switch from rifle to pistol.

I'll send you the full example that's using custom animations. This is just a simplified example to highlight the problem.

Share this post


Link to post
Share on other sites

Here's another example. I think I'm getting closer to the root of the problem.

 

The cfg below should let you switch between rifle and handgun, and provide no other actions.

 

However, when switching into the handgun, it gets stuck in the transition (see video above). I've found that if I change upDegree on HandGunOnStateActions class to match the upDegree on PrimaryWeaponStateAction, the switch works correctly. However, I'm no longer able to shoot the handgun if I use the upDegree ManPosCombat.

 

Anyone know what might be causing this problem?

class CfgMovesBasic
{
    class ManActions
    {
        AURRappel="PrimaryWeaponState";    
                                
    };
    class Actions
    {
        class NoActions;
        class PrimaryWeaponStateActions : NoActions
        {
	    upDegree="ManPosCombat";
            HandGunOn="HandGunOnState";
            PrimaryWeapon="PrimaryWeaponState";
        };
        class HandGunOnStateActions : NoActions
        {
	    upDegree = "ManPosHandGunStand";
            HandGunOn="HandGunOnState";
            PrimaryWeapon="PrimaryWeaponState";
        };
    };
};


class CfgMovesMaleSdr: CfgMovesBasic
{
    class States
    {
        class AmovPercMstpSrasWrflDnon;
        class PrimaryWeaponState : AmovPercMstpSrasWrflDnon
        {
            actions="PrimaryWeaponStateActions";	
	    variantsPlayer[]={};		
	    variantsAfter[]={};
	    variantsAI[]={};
	    InterpolateTo[]={};	
            ConnectTo[]= {
                "PrimaryWeaponState",0.1,"HandGunOnState", 0.1
            };            
        };
	class AmovPercMstpSrasWpstDnon;
        class HandGunOnState : AmovPercMstpSrasWpstDnon
        {
            actions="HandGunOnStateActions";	
	    variantsPlayer[]={};
	    variantsAI[]={};	
            variantsAfter[]={};
	    InterpolateTo[]={};	
            ConnectTo[]= {
                "HandGunOnState",0.1,"PrimaryWeaponState", 0.1
            };            
        };
    };
};

Share this post


Link to post
Share on other sites

FYI - this has been resolved. Had to do with the chain of animation states. Within the chain, I had to make the second to last state align with the last state. (e.g. holding rifle in air ----> move from rifle to holding pistol in air ---> holding pistol in air). If the second to last and last animations don't align, it causes the flickering (e.g. holding rifle in air ----> holding pistol in air )

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×