Home   Help Search Login Register  

Author Topic: Animated Models  (Read 2656 times)

0 Members and 1 Guest are viewing this topic.

Animated Models
« on: 29 Jul 2007, 13:17:20 »
Hey guys,

I've been converting some of my old Opflash addons to work in ArmA but I've noticed they've changed the Class Animation to AnimationSources? To start with, my model wouldn't load at all, then I get a few config errors (adding onlyForPlayer = 1 fixed the last problem) Now it's error free but the doors on the model just don't animate. The user action appears and seems to cycle between Open and Close, but the doors don't move.

I asume Animation is defined elsewhere since the in-game buildings show very little in their AnimationSources Class. Below is my config (which worked in Opflash) the Class AnimationSources is lifted staight from old Class Animation to stop the game from complaining.

      ...
      ...
      ...
      animated=1;
      class AnimationSources
      {
         class CabDoorL
         {
            type="rotation";
            animPeriod=1;
            selection="CabDoorL";
            axis="CabDoorL_Pivot";
            angle0=0;
            angle1=-1.9;
         };
         class CabDoorR
         {
            type="rotation";
            animPeriod=1;
            selection="CabDoorR";
            axis="CabDoorR_Pivot";
            angle0=0;
            angle1=1.9;
         };   
      };

      class UserActions
      {
         class ODoor
         {
            displayName="Open Cabinet";
            position="CabDoorSensor";
            radius=1;
            onlyForPlayer = 1;
            condition="this animationPhase ""CabDoorL"" < 0.5 and this animationPhase ""CabDoorR"" < 0.5";
            statement="this animate [""CabDoorL"", 1]; this animate [""CabDoorR"",1];";
         };
         class CDoor
         {
            displayName="Close Cabinet";
            position="CabDoorSensor";
            radius=1;
            onlyForPlayer = 1;
            condition="this animationPhase ""CabDoorL"" > 0.5 and this animationPhase ""CabDoorR"" > 0.5";
            statement="this animate [""CabDoorL"", 0]; this animate [""CabDoorR"",0];";
         };
      };

Has anyone figured out the Class AnimationSources and where to define selection, axis, type, animPeriod and all the other settings?
There are 10 types of people in the world. Those who understand binary, and those who don't

Re: Animated Models
« Reply #1 on: 28 Aug 2007, 00:38:18 »
There's still the Animations class, but you also need the AnimationSources class (I'm not 100% sure how many classes you need, so use the config mentioned in this thread).

Offline Flaber

  • Members
  • *
    • Escuadron 13th TigerSharks
Re: Animated Models
« Reply #2 on: 18 Sep 2007, 21:38:14 »
in cfgvehicles you need animationsources class, and animations class is now defined in cfgmodels

with useractions you make the anim runs


Offline Obmar

  • Members
  • *
  • - Obmar -
    • Bush Wars Mod
Re: Animated Models
« Reply #3 on: 18 Apr 2008, 05:39:34 »
ArmA now uses 2 files config.cpp and models.cfg for the addon configuration. This is very important to get the models to animate properly in game. The config.cpp file is where you script the addon configuration eg CfgPatches, cfgvehicles etc. The model.cfg file is where the class CfgSkeletons and class CfgModels is defined, this file is used by the BinPBO to attach the animations directly to the model when binarizing the addon.

Here is a sample of a config for some African huts I am making just to give you an idea. These are the configs for both files.

config.cpp

Quote
class CfgPatches
{
   class bwc_AfricanHuts
   {
      units[] = {"bwc_MudHut1","bwc_MudHut1b","bwc_MudHut2","bwc_StickHut1"};
      weapons[] = {};
      requiredVersion = 1.000000;
      requiredAddons[] = {CAData,CABuildings,CAMisc};
      version = 1.08;
   };
};

class CfgVehicleClasses
{
   class BWC_AfricanHuts
   {
      displayName = "Bush Wars - African Huts";
   };
};

class CfgVehicles 
{
   class Ruins;
    class land_bwc_MudHut_ruins: Ruins
    {
        scope = 2;
        vehicleClass = "BWC_AfricanHuts";
        model = "\bwc_AfricanHuts\bwc_MudHut_ruins.p3d";
       displayName = "Mud Hut ruins";
    };
   class land_bwc_StickHut_ruins: Ruins
    {
        scope = 2;
        vehicleClass = "BWC_AfricanHuts";
        model = "\bwc_AfricanHuts\bwc_StickHut_ruins.p3d";
       displayName = "Herero Tribal Hut ruins";
    };
    class HouseBase;
    class House: HouseBase
    {
        class DestructionEffects;
    };
   
   
   class land_bwc_MudHut1: House
   {
      scope = 2;
      animated = 1;
      vehicleClass = "BWC_AfricanHuts";
      displayName = "African Mud Hut 1 (round)";
      model = "\bwc_AfricanHuts\bwc_MudHut1.p3d";
      icon = "\bwc_AfricanHuts\data\ico\MudHut_r_ca.paa";   
      ladders[] = {};
      mapSize = 10;
      armor = 400;

      class DestructionEffects: DestructionEffects
        {
            class Ruin1
            {
             simulation = "ruin";
             type=\bwc_AfricanHuts\bwc_MudHut_ruins.p3d;
             position = "";
             intensity = 1;
             interval = 1;
             lifeTime = 1;
            };
        };
      
      class AnimationSources
      {
         class door_1
         {
            source = "user"; //The controller is defined as a user animation.
            animPeriod = 1.5;  //The animation period used for this controller.
            initPhase = 0;     //Initial phase when object is created. 0 = CLOSED      
         };               
      };
      class UserActions
      {
         class OpenDoors
         {
            displayName = "Open Door";
            onlyforplayer = true;
            position ="door1_axis";
            radius = 3;
            condition = "this animationPhase ""door_1"" < 0.5";
            statement = "this animate [""door_1"", 1]; this say ""bwc_openhutdoor""";
         };
         class CloseDoors
         {
            displayName = "Close Door";
            onlyforplayer = true;
            position = "door1_axis";
            radius = 3;
            condition = "this animationPhase ""door_1"" >= 0.5";
            statement = "this animate [""door_1"", 0]; this say ""bwc_openhutdoor""";
         };
      };
      actionBegin1 = OpenDoors;
      actionEnd1 = OpenDoors;
   };
   class land_bwc_StickHut1: House
   {
      scope = 2;
      animated = 1;
      vehicleClass = "BWC_AfricanHuts";
      displayName = "Herero Tribal Hut 1 (round)";
      model = "\bwc_AfricanHuts\bwc_StickHut1.p3d";
      icon = "\bwc_AfricanHuts\data\ico\MudHut_r_ca.paa";   
      ladders[] = {};
      mapSize = 10;
      armor = 400;

      class DestructionEffects: DestructionEffects
        {
            class Ruin1
            {
             simulation = "ruin";
             type=\bwc_AfricanHuts\bwc_StickHut_ruins.p3d;
             position = "";
             intensity = 1;
             interval = 1;
             lifeTime = 1;
            };
        };
      
      class AnimationSources
      {
         class door_1
         {
            source = "user"; //The controller is defined as a user animation.
            animPeriod = 1.5;  //The animation period used for this controller.
            initPhase = 0;     //Initial phase when object is created. 0 = CLOSED      
         };               
      };
      class UserActions
      {
         class OpenDoors
         {
            displayName = "Open Door";
            onlyforplayer = true;
            position ="door1_axis";
            radius = 3;
            condition = "this animationPhase ""door_1"" < 0.5";
            statement = "this animate [""door_1"", 1]; this say ""bwc_openhutdoor""";
         };
         class CloseDoors
         {
            displayName = "Close Door";
            onlyforplayer = true;
            position = "door1_axis";
            radius = 3;
            condition = "this animationPhase ""door_1"" >= 0.5";
            statement = "this animate [""door_1"", 0]; this say ""bwc_openhutdoor""";
         };
      };
      actionBegin1 = OpenDoors;
      actionEnd1 = OpenDoors;
   };

   class land_bwc_MudHut1b: land_bwc_MudHut1
   {
      model = "\bwc_AfricanHuts\bwc_MudHut1b.p3d";
      //icon = "\bwc_AfricanHuts\data\ico\MudHut_s_ca.paa";
      displayName = "African Mud Hut 2 (round)";
      armor = 500;
   };
   
   class land_bwc_MudHut2: land_bwc_MudHut1b
   {
      model = "\bwc_AfricanHuts\bwc_MudHut2.p3d";
      //icon = "\bwc_AfricanHuts\data\ico\MudHut_s_ca.paa";
      displayName = "African Mud Hut 1 (square)";
      armor = 500;
   };
   
};

class CfgSounds
{
       class bwc_openhutdoor
   {
         sound[]={"\bwc_AfricanHuts\data\fx\openhutdoor.ogg",1.000000,1.000000};
         name = "BWC_openhutdoor";
      titles[] = {};
   };       
};


model.cfg

Quote
class CfgSkeletons
{
   class Default;
   class bwc_hut_Skeleton
   {
      isDiscrete = 1;
      skeletonInherit = "";
      skeletonBones[] =
      {
         "door1",""
      };
   };
};
class Rotation;
class CfgModels
{      
     
      class Default;
   class bwc_AfricanHuts: Default
   {
      sectionsInherit = "";
      sections[] =
      {
         "door1"
         
      };

      skeletonName = "bwc_hut_Skeleton";
   };
   class bwc_MudHut1: bwc_AfricanHuts
   {
      class Animations
      {
         class door_1
         {
            type = "rotation";
            memory="true";
            animPeriod = 1.5;
            selection = "door1";
            axis = "door1_axis";
            angle0 = 0;
            minValue = 0;
            maxValue = 1;
            source = "user";
            angle1= -1.5;
         };
      };
   };
   class bwc_MudHut1b: bwc_MudHut1{};
   class bwc_MudHut2: bwc_MudHut1{};
   class bwc_StickHut1: bwc_MudHut1{};
};
   
   
Lots of addon makers are still making the mistake of adding the CfgSkeletons and CfgModels to the config.cpp file. The correct way is as per the samples I have posted. A lot of animations don't work properly after the binarization of the model if you don't do it this way using the 2 seperate files. Once the addon is binarized BinPBO does not add the model.cfg to the .pbo as that is hardcoded to the model. That is why when we unbin (Using Kegetty's tool) the .pbo files we dont see the model.cfg file in the unbined file.

Hope this helps and answers your question.
« Last Edit: 18 Apr 2008, 05:47:37 by Obmar (Bush Wars) »
One man's terrorist is another man's freedom fighter.

Offline Delta Hawk

  • Members
  • *
  • I'm a llama!
Re: Animated Models
« Reply #4 on: 26 Aug 2008, 06:14:13 »
SOOO  in the addon folder, ur gonna have a config.cpp or config.bin AND a model.cfg????????

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Animated Models
« Reply #5 on: 26 Aug 2008, 12:17:04 »
The model.cfg file is not included in the pbo which is created after binarizing, it is only used to add the cfgskeletons and cfgmodels from the model.cfg into the model itself during binarization.

You will end up with a config.bin and no other configuration files as all the info from model.cfg is incorporated into the model itself.

Maybe   :cool2:


Planck
I know a little about a lot, and a lot about a little.