This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
arma:howto_animate_model [2009-04-16 12:44] snakeman added machine gun belt rotation quick tutorial. |
arma:howto_animate_model [2009-04-17 12:01] snakeman added animate cargo door tips. |
||
---|---|---|---|
Line 396: | Line 396: | ||
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. | 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> |