Jump to content
JuuRanium1

Trouble with doors

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:

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 = "ISOC - Epic";
        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          = 5; // 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"",1]";
            };
            class CloseDoor_01: OpenDoor_01
            {
                displayName = "Close Door";
                priority    = 0.2;
				condition = "this animationSourcePhase ""door_01_rot"" == 1";
				statement = "this animate [""door_01"",0]";
            };
        };
        actionBegin1    = OpenDoor_01;
        actionEnd1      = OpenDoor_01;
        numberOfDoors   = 1;
    };
};

Model:

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          = 1;
                minValue        = 0; // 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

try this on open door :

condition = ((this animationSourcePhase 'door_01') < 0.5);
statement = this animateSource ["door_01",1];

this on close door:

condition = ((this animationSourcePhase 'door_01') >= 0.5);
statement = this animateSource ["door_01",0];

and make shure that you have the door selections right in all lods, especially with geometry lod

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

×