Jump to content
Lopalmcivet _

retract animation speed

Recommended Posts

As shown in the video, I made a retractable thing, but obviously the retracting speed is too fast, almost in a second. How can I make it slowly rise and fall slowly?

Share this post


Link to post
Share on other sites

            class riseAndfall{
                type="translationy";
                source="user";
                selection="retract";
                sourceAddress="clamp";
                minPhase=0;
                maxPhase=1;
                minValue=0;
                maxValue=1;
                memory=0;
                offset0=0;
                offset1=1;

 

and here is the model.cfg 

I don't know if it has something to do with these values?

Share this post


Link to post
Share on other sites
8 hours ago, NightIntruder said:

Try this:


class riseAndfall
{
	type="translationy";
	source="user";
	selection="retract";
	sourceAddress="clamp";
	minPhase=0;
	maxPhase=1;
	minValue=0;
	maxValue=1;
	memory=0;
	offset0=0;
	offset1=1;
	animPeriod=5;
};

wiki: https://community.bistudio.com/wiki/Model_Config

I've tried all about animPeriod and it doesn't work.I also tried binarize but still not work.Now I really don't understand why the animation completes in a split second

Share this post


Link to post
Share on other sites
11 hours ago, Lopalmcivet _ said:

I've tried all about animPeriod and it doesn't work.I also tried binarize but still not work.Now I really don't understand why the animation completes in a split second

Does the animation work in OB2 as intended? Check if you have an additional animation in your model.cfg that controls "refract" component with different animation sources (eg. time). Maybe you use the relevant scripting command in your UserAction in the wrong way(?). Both commands have an additional "speed" parameter, which - if used incorrectly - can act as an "instant" modifier.

https://community.bistudio.com/wiki/animateSource
https://community.bistudio.com/wiki/animate

Share this post


Link to post
Share on other sites
1 hour ago, NightIntruder said:

Does the animation work in OB2 as intended? Check if you have an additional animation in your model.cfg that controls "refract" component with different animation sources (eg. time). Maybe you use the relevant scripting command in your UserAction in the wrong way(?). Both commands have an additional "speed" parameter, which - if used incorrectly - can act as an "instant" modifier.

https://community.bistudio.com/wiki/animateSource
https://community.bistudio.com/wiki/animate

I found that if I define it as Hatch and then I press turn out in the game then everything works fine, but my own defined useraction has the problem

 

        class UserActions
        {
            class opendoor
            {
                displayName="up";

                hideOnUse=1;
                condition="this animationPhase ""riseAndfall"" < 0.5";
                statement="this animate [""riseAndfall"", 1];";
            };
            class closedoor
            {
                displayName="down";

                hideOnUse=1;
                condition="this animationPhase ""riseAndfall"" >= 0.5 ";
                statement="this animate [""riseAndfall"", 0];";
            };
        };

        class AnimationSources
        {
            class recoil_source {source = "reload";weapon = "In_S53";};
            //class muzzle_rot {source = "ammorandom"; weapon = "In_AZP23";};
            class HatchC
            {
                source="door";
                animPeriod=0.80000001;
            };
            class HatchG: HatchC {};
            class HatchD: HatchC {};
            class riseAndfall
            {
                displayname="riseAndfall";
                source="user";
                 animPeriod=1;
                 sourceAddress="loop";
                    minValue=0;
                   maxValue=1;

            };
        };

 

that's what in my config there shouldn't be any script here either.

Share this post


Link to post
Share on other sites

I would recommend reading this wiki (carefully):
https://community.bistudio.com/wiki/Model_Config
There's a sample of animationSource which doesn't have the parts you have in yours. Don't try to overcomplicate things if you don't know what you're doing. This will surely come later, lol.

Try this:
model.cfg

class Lmc_riseAndfall  //naming convention that uses author's tag is recommended to avoid confusion when some addons would use exactly the same name
{
	type="translationY"; //yes you can use this axis, but...
	axis = ""; //you have to define an empty axis as well IIRC, otherwise it'll throw an error in RPT
	source="Lmc_riseAndfall_source"; //I changed the name of source to make it clearer for you
	selection="retract"; //name of bone to be animated
	sourceAddress="clamp";
	minPhase=0;
	maxPhase=1;
	minValue=0; 
	maxValue=1; 
	memory=0; //if you define your custom axis, this must be 1 (obviously ONLY if your custom axis was made in Memory Points LOD)
	offset0=0; //bear in mind, if you don't define custom axis, the values will represent meters
	offset1=1; //if you define custom axis, both values refer to the distance (line) between both mem points that make your custom axis
};

config.cpp
animationSources

class AnimationSources
{
  class Lmc_riseAndfall_source
  {
    source="user";
    animPeriod=5; //made the time of the animation bigger just to have clear comparison
    initPhase=0; //in what state the animation will initially be after the initlialization of the vehicle in game (in this case: fully lowered/closed)
  };
};

userActions

class UserActions
{
	class Lmc_apc_risemast //meaningful names are helpful, especially after a few months when you'll forget what exactly it was supposed to mean and do
	{
		displayName="Rise the sensor mast"; //here, the same as in the above comment.
		hideOnUse=1;
		condition="this animationSourcePhase ""Lmc_riseAndfall_source"" < 0.5"; //different scripting commands are used to animate custom animationSources
        	statement="this animateSource [""Lmc_riseAndfall_source"", 1];"; //using animateSource (whenever possible) is reccomended by BI as more efficient and MP-friendly than using regular "animate"
	};
	class Lmc_apc_lowermast
	{
		displayName="Lower the sensor mast";
		hideOnUse=1;
		condition="this animationSourcePhase ""Lmc_riseAndfall_source"" >= 0.5 ";
		statement="this animateSource [""Lmc_riseAndfall_source"", 0];";
	};
};

Bear in mind, that in "statement" the scripting command "animateSource" has third parameter - a "speed" multiplier of the animation (optional). Sometimes I found it buggy and had to add the parameter to have a working condition line.
If you, for whatever reason, won't have an access to both userActions (it happened to me several times), just change the lines of condition in both actions for checking the regular source of animation, like this:

condition="this animationPhase ""Lmc_riseAndfall"" =< 0.5";  //for rise the mast

and 

condition="this animationPhase ""Lmc_riseAndfall"" >= 0.5"; //for lower the mast

Also, making comments in lines (preferably in English) may help as well, so whoever would take care of your initial work in the future may have an easier task while working on it.
Again, I highly recommend reading the wiki when it comes to the animation system in Arma 3. 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
On 10/17/2022 at 9:14 PM, NightIntruder said:

I would recommend reading this wiki (carefully):
https://community.bistudio.com/wiki/Model_Config
There's a sample of animationSource which doesn't have the parts you have in yours. Don't try to overcomplicate things if you don't know what you're doing. This will surely come later, lol.

Try this:
model.cfg


class Lmc_riseAndfall  //naming convention that uses author's tag is recommended to avoid confusion when some addons would use exactly the same name
{
	type="translationY"; //yes you can use this axis, but...
	axis = ""; //you have to define an empty axis as well IIRC, otherwise it'll throw an error in RPT
	source="Lmc_riseAndfall_source"; //I changed the name of source to make it clearer for you
	selection="retract"; //name of bone to be animated
	sourceAddress="clamp";
	minPhase=0;
	maxPhase=1;
	minValue=0; 
	maxValue=1; 
	memory=0; //if you define your custom axis, this must be 1 (obviously ONLY if your custom axis was made in Memory Points LOD)
	offset0=0; //bear in mind, if you don't define custom axis, the values will represent meters
	offset1=1; //if you define custom axis, both values refer to the distance (line) between both mem points that make your custom axis
};

config.cpp
animationSources


class AnimationSources
{
  class Lmc_riseAndfall_source
  {
    source="user";
    animPeriod=5; //made the time of the animation bigger just to have clear comparison
    initPhase=0; //in what state the animation will initially be after the initlialization of the vehicle in game (in this case: fully lowered/closed)
  };
};

userActions


class UserActions
{
	class Lmc_apc_risemast //meaningful names are helpful, especially after a few months when you'll forget what exactly it was supposed to mean and do
	{
		displayName="Rise the sensor mast"; //here, the same as in the above comment.
		hideOnUse=1;
		condition="this animationSourcePhase ""Lmc_riseAndfall_source"" < 0.5"; //different scripting commands are used to animate custom animationSources
        	statement="this animateSource [""Lmc_riseAndfall_source"", 1];"; //using animateSource (whenever possible) is reccomended by BI as more efficient and MP-friendly than using regular "animate"
	};
	class Lmc_apc_lowermast
	{
		displayName="Lower the sensor mast";
		hideOnUse=1;
		condition="this animationSourcePhase ""Lmc_riseAndfall_source"" >= 0.5 ";
		statement="this animateSource [""Lmc_riseAndfall_source"", 0];";
	};
};

Bear in mind, that in "statement" the scripting command "animateSource" has third parameter - a "speed" multiplier of the animation (optional). Sometimes I found it buggy and had to add the parameter to have a working condition line.
If you, for whatever reason, won't have an access to both userActions (it happened to me several times), just change the lines of condition in both actions for checking the regular source of animation, like this:


condition="this animationPhase ""Lmc_riseAndfall"" =< 0.5";  //for rise the mast

and 

condition="this animationPhase ""Lmc_riseAndfall"" >= 0.5"; //for lower the mast

Also, making comments in lines (preferably in English) may help as well, so whoever would take care of your initial work in the future may have an easier task while working on it.
Again, I highly recommend reading the wiki when it comes to the animation system in Arma 3. 

 

thx for your patient comment, I will refer to your comments and try

 

 

  • Like 1

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

×