User Tools

Site Tools


arma:howto_animate_model

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
arma:howto_animate_model [2007-07-12 04:31]
snakeman changed page pretty much
arma:howto_animate_model [2016-11-04 22:30]
snakeman moved images from nekromantix to this domain.
Line 15: Line 15:
 Besides adding selections (same as in OFP but in ArmA bone selections should never overlap) you also need to add a following named property to your first resolution LOD (press **ALT-P** to open named properties window): Besides adding selections (same as in OFP but in ArmA bone selections should never overlap) you also need to add a following named property to your first resolution LOD (press **ALT-P** to open named properties window):
  
-<​code>​+<​code ​cpp>
    ​property name: autocenter    ​property name: autocenter
    ​value:​ 0    ​value:​ 0
 </​code>​ </​code>​
  
-If your model has Geometry LOD the above needs to be also done for your Geometry LOD. This property ​stopps ​engine from shifting the animation axes.+If your model has Geometry LOD the above needs to be also done for your Geometry LOD. This property ​stops engine from shifting the animation axes.
  
-If you encounter a bug when your weapon bones fall apart after you dropp it to the ground the reason might be lack of Geometry or View - pilot LODs.+If you encounter a bug when your weapon bones fall apart after you drop it to the ground the reason might be lack of Geometry or View - pilot LODs.
  
 ====== model.cfg ====== ====== model.cfg ======
Line 47: Line 47:
 A bone is defined by using two strings: A bone is defined by using two strings:
  
-<​code>​+<​code ​cpp>
 :"​bone",""​ :"​bone",""​
 </​code>​ </​code>​
  
-You may define multiple bones by strining ​them togeter.+You may define multiple bones by stringing ​them together.
  
 **Attention:​** Do not leave out the second string as this will lead to errors! (see linked bones for more information on the second string argument) **Attention:​** Do not leave out the second string as this will lead to errors! (see linked bones for more information on the second string argument)
Line 57: Line 57:
 **Example** **Example**
  
-<​code>​+<​code ​cpp>
 skeletonBones[]= skeletonBones[]=
 { {
Line 69: Line 69:
 The second argument (empty in the example above) is used for linking two bones: The second argument (empty in the example above) is used for linking two bones:
  
-<​code>​+<​code ​cpp>
 :"​bone1","​bone2"​ :"​bone1","​bone2"​
 </​code>​ </​code>​
Line 77: Line 77:
 **Example** **Example**
  
-<​code>​+<​code ​cpp>
 skeletonBones[]= skeletonBones[]=
 { {
Line 89: Line 89:
 You can not link more than two bones in a row! If you do something like You can not link more than two bones in a row! If you do something like
  
-<​code>​+<​code ​cpp>
 "​bone1","​bone2","​bone3"​ "​bone1","​bone2","​bone3"​
 </​code>​ </​code>​
Line 99: Line 99:
 However, it should be possible to use a syntax like this (not tested yet): However, it should be possible to use a syntax like this (not tested yet):
  
-<​code>​+<​code ​cpp>
 skeletonBones[]= skeletonBones[]=
 { {
Line 112: Line 112:
 **cfgSkeletons Example** **cfgSkeletons Example**
  
-<​code>​+<​code ​cpp>
 class cfgSkeletons class cfgSkeletons
 { {
Line 155: Line 155:
 **Example** **Example**
  
-<​code>​+<​code ​cpp>
 sections[]= sections[]=
 { {
Line 167: Line 167:
 **Animations** **Animations**
  
-To define animations for your model, you have to make use of the class animations in your modelclass. Each animation is a subclass in the class animations with a userdefinable ​name and consists of the following parameters:+To define animations for your model, you have to make use of the class animations in your modelclass. Each animation is a subclass in the class animations with a user definable ​name and consists of the following parameters:
  
 ^ Parameter ^ Description ^ ^ Parameter ^ Description ^
Line 195: Line 195:
 **Example** **Example**
  
-<​code>​+<​code ​cpp>
 class mainRotor class mainRotor
 { {
Line 217: Line 217:
 Keep in mind that this image shows only the direction of these axes and //not// their position. The position is always defined by the center of your animated selection. Keep in mind that this image shows only the direction of these axes and //not// their position. The position is always defined by the center of your animated selection.
  
-As a short examle, the wheels would need "​rotationX"​ as animation type.+As a short example, the wheels would need "​rotationX"​ as animation type.
  
-{{http://tactical.nekromantix.com/images/wiki/​howtoanimmodel_axes.jpg}}+{{http://pmc.editing.wiki/​images/​howtoanimmodel_axes.jpg}}
  
 **cfgModels example** **cfgModels example**
  
-<​code>​+<​code ​cpp>
 class cfgModels class cfgModels
 { {
Line 329: Line 329:
  };  };
 }; };
 +</​code>​
 +
 +====== Machine Gun Belt Rotation ======
 +
 +Open your model in O2 and make a selection called "​belt_rotation",​ redefine the entire belt of bullets you want move on your MG and save it.
 +
 +Inside your model.cfg file open this class:
 +<code cpp>
 +class CfgSkeletons
 +{
 + class NameOfYourWeapon
 + {
 + isDiscrete = 0;
 + skeletonInherit = "";​
 + skeletonBones[] =
 + {
 + "​belt_rotation",​ ""​
 + };
 + };
 +};
 +</​code>​
 +Again in the model.cfg file, inside your CfgModels describe the new selection and animation as you see below.
 +<code cpp>
 +class CfgModels
 +{
 + class Default
 + {
 + sections[] = {};
 + sectionsInherit = "";​
 + };
 +
 + class Weapon: default{};
 +
 + class NameOfYourWeapon
 + {
 + skeletonName = "​NameOfYourWeapon";​
 +
 + class Animations
 + {
 +
 + class belt_rotation
 + {
 + type = "​rotationx";​
 + source = "​reload";​
 + selection = "​belt_rotation";​
 + axis = "​belt_rotation_axis";​
 + minValue = 0;
 + maxValue = "​5";​
 + angle0 = "​0";​
 + angle1 = "​1";​
 + };
 + };
 +
 + sections[] = { "​zasleh"​ };
 + sectionsInherit = "";​
 + };
 +};
 +</​code>​
 +To play around with the sliding belt you just need to take two values in consideration.
 +
 +The first is the type = "",​ "​rotationx"​ will move you belt from the left to the right or right to the left, the second is the definition of the starting side the angle1 = ""​.
 +
 +"​0"​ is a static value which means it won't move at all, negative values like "​-1",​ "​-2"​ ... will make the belt move from the right to the left, positive values like the "​1",​ "​2"​ ... will make it move from the left to the right.
 +
 +One thing to take into consideration is the "​rotationz"​ not presented here. Let's say you have the belt not attached to a box but instead falling from the ground. If that is the case you want the belt to move from below to above, for that you will use the "​rotationz"​ and again you play with the angle called angle1 = ""​ to set direction of the belt's movement.
 +
 +Now something worth noticing, let's say that you want the belt to move not straight but unbalanced, for that you will play with the angle0 = ""​. I think most of us won't be using this angle but now you know what it does.
 +
 +
 +====== Animate Cargo Door ======
 +
 +In your model.cfg file in cfgModels put this for example:
 +<code cpp>
 +class Animations
 +{
 + class cargodoor
 + {
 + type = "​rotation";​
 + source = "​MoveX1";​
 + animPeriod = 2.5;
 + sourceAddress = "​clamp";​
 + selection = "​cargodoor";​
 + axis = "​osa_cargodoor";​
 + memory = true;
 + minValue = 0;
 + maxValue = 1;
 + angle0 = 0;
 + angle1 = -0.488690;
 + };
 +</​code>​
 +
 +In config.cpp file in cfgVehicles put this:
 +<code cpp>
 + class AnimationSources:​ AnimationSources
 + {
 + class MoveX1 // Should be the same as your selection name.
 + {
 + source = "​user";​ //The controller is defined as a user animation.
 + animPeriod = 10;  //The animation period used for this controller.
 + initPhase = 0;     //​Initial phase when object is created. 0 = CLOSED
 + };
 + };
 +</​code>​
 +And
 +<code cpp>
 + class UserActions
 + {
 + class CargoDoor_OpenP
 + {
 + displayName = "Open cargodoor";​
 + position = "​pilotcontrol";​
 + onlyforplayer = false;
 + radius = 0.5;
 + condition = "this animationPhase ""​cargodoor_down""​ < 0.5";
 + statement = "this animate [""​cargodoor_down"",​1];​ this animate [""​cargodoor_up"",​1]";​
 + };
 </​code>​ </​code>​
arma/howto_animate_model.txt · Last modified: 2017-10-06 22:08 by snakeman