Jump to content

Recommended Posts

Hello!

 

I have a problem modelling my door. I see the user action, so the trigger works. But the animation doesn't do anything. Could someone check my code and see if I am making some stupid mistake??

 

Config File:

class CfgPatches
{
    class A3_MyAddon
    {
        units[]=
        {
            ""
        };
        weapons[]=
        {
        };
        requiredVersion=0.1;
    };
};
class CfgVehicles
{
    class House;
    class TestObject : House
    {
        scope       = 2;
        model       = "\Objects\TestObject.p3d";
        placement   = vertical;
        mapSize     = 20;
        displayName = "Test";
		author = "None";
        cost        = 0;
        armor       = 5000;

        class AnimationSources
        {
            // Animation sources for doors
            class door_01_source
            {
                source      = user; // "user" = custom source = not controlled by some engine value
				initPhase = 0; // Initial value of animations based on this source
				animPeriod = 1; // Coefficient for duration of change of this animation
            };
        };

        class UserActions
        {
            class OpenDoor_01
            {
                displayName     = "Open Door"; // Label of the action used in the action menu itself.
                position        = door_01_trigger; // Point in Memory lod in p3d around which the action is available.
                priority        = 0.4; // Priority coefficient used for sorting action in the action menu.
                radius          = 3; // Range around the above defined point in which you need to be to access the action.
                onlyForPlayer   = false; // Defines if the action is available only to players or AI as well.
								condition = "this animationSourcePhase ""door_01_rot"" == 0";
								statement = "this animate [""door_01_rot"",1]";
            };
            class CloseDoor_01: OpenDoor_01
            {
                displayName = "Close Door";
                priority    = 0.2;
				condition = "this animationSourcePhase ""door_01_rot"" == 1";
				statement = "this animate [""door_01_rot"",0]";
            };
        };
        actionBegin1    = OpenDoor_01;
        actionEnd1      = OpenDoor_01;
        numberOfDoors   = 1;
    };
};

Model file:

class CfgSkeletons
{
    class Default
    {
        isDiscrete = 1;
        skeletonInherit = "";
        skeletonBones[] = {};
    };
    class TestObject_Skeleton: Default
    {
        skeletonInherit = "Default";
        skeletonBones[] =
        {
            "door_01",   "",
        };
    };
class CfgModels
{
    class Default
    {
        sectionsInherit = "";
        sections[] = {};
        skeletonName = "";
    };
    class TestObject: Default
    {
        skeletonName = "TestObject_Skeleton";
        class Animations
        {
            class door_01_rot
            {
                type            = rotation;
                source          = door_01_source; // Controler defined in class AnimationSources in config.cpp.
                selection       = door_01; // Selection from p3d that also has to be defined as a bone in this model`s skeleton.
                axis            = door_01_axis; // Axis of the rotation.
                memory          = 0;
                minValue        = 0.1; // Value of the controller at which the rotation will be angle0
                maxValue        = 1; // Value of the controller at which the rotation will be angle1
                angle0          = 0;
                angle1          = (rad 110);
            };
        };
    };
  };
};

 

Share this post


Link to post
Share on other sites
14 hours ago, JuuRanium1 said:

 

I have a problem modelling my door. I see the user action, so the trigger works. But the animation doesn't do anything. Could someone check my code and see if I am making some stupid mistake??

Does animation work in buldozer?

Share this post


Link to post
Share on other sites
32 minutes ago, JuuRanium1 said:

No. @reyhard

Then we can assume there is an issue with either the named selection ("door_01") or the axis ("door_01_axis") defined in your model.cfg

Are they both correctly named to match your model.cfg

Until the animation works in Buldozer it won't work ingame.

Share this post


Link to post
Share on other sites
12 minutes ago, JuuRanium1 said:

As far as I can see everything should be correct.

 

You can check my P3D: https://we.tl/t-wq6u5qVHfQ
@Jackal326

It was only when I copied your above model.cfg into a new txt file to make my own to test it your model out that I noticed you haven't closed out the cfgSekelton section with a };

You have an extra }; at the end of the file too...

 

class CfgSkeletons
{
	class Default
	{
		isDiscrete = 1;
		skeletonInherit = "";
		skeletonBones[] = {};
	};

	class TestObject_Skeleton: Default
	{
		skeletonInherit = "Default";
		skeletonBones[] =
		{
			"door_01",   "",
		};
	};
};

class CfgModels
{
	class Default
	{
		sectionsInherit = "";
		sections[] = {};
		skeletonName = "";
    	};

	class TestObject: Default
    	{
		skeletonName = "TestObject_Skeleton";
 		class Animations
        	{
			class door_01_rot
			{
				type = rotation;
				source = door_01_source; // Controler defined in class AnimationSources in config.cpp.
				selection = door_01; // Selection from p3d that also has to be defined as a bone in this model`s skeleton.
				axis = door_01_axis; // Axis of the rotation.
				memory = 0;
				minValue = 0.1; // Value of the controller at which the rotation will be angle0
				maxValue = 1; // Value of the controller at which the rotation will be angle1
				angle0 = 0;
				angle1 = (rad 110);
			};
		};
	};
};

That works fine (just tested it).

 

A helpful tip to avoid similar missing }; is to use the tab-formatting as above. Lines up the { with the }; quite nicely - also makes it easier to identify any extra }; at the end of your class structuring.

Share this post


Link to post
Share on other sites

I didn't use a config, I just checked the animation in O2/Buldozer and that worked fine. I assumed it would work ingame but perhaps an issue is present on the config.cpp side of things. For that it is perhaps best to defer to @reyhard's assistance as I've not really worked much with static object animations.

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

×