alleycat 28 Posted August 5, 2014 How to animate a bolt moving? I have looked at the sample file, added my own bolt_axis points. This is the model.cfg: class CfgSkeletons { class Test_Weapon { pivotsModel=""; isDiscrete = 0; skeletonInherit = ""; skeletonBones[] = { "trigger", "", /// not in this model, but good to use "bolt", "", "bolt_catch", "", "magazine", "", "safety", "", "muzzleFlash", "", "OP", "", "ForeSight", "", "BackSight", "" }; }; }; class CfgModels { class Default; class Optic: Default { sections[]= { "zasleh" }; }; class Weapon: Default { sections[]= { "zasleh" }; htMin = 1; // Minimum half-cooling time (in seconds) htMax = 600; // Maximum half-cooling time (in seconds) afMax = 0; // Maximum temperature in case the model is alive (in celsius) mfMax = 0; // Maximum temperature when the model is moving (in celsius) mFact = 1; // Metabolism factor - number from interval <0, 1> (0 - metabolism has no influence, 1 - metabolism has full influence (no other temperature source will be considered)). tBody = 100; // Metabolism temperature of the model (in celsius) skeletonName="Weapon"; class Animations { class zaslehROT { type="rotation"; source="clockMinute"; sourceAddress="loop"; selection="zasleh"; begin="usti hlavne"; end="konec hlavne"; memory=1; minValue=0.0166665; maxValue=0.016666666666666666666666666666667; angle0="rad 0"; angle1="rad 360"; }; class magazine_hide { type="hide"; source="reloadMagazine"; sourceAddress="mirror"; selection="magazine"; minValue=0.0; maxValue=0.4; hideValue=0.5; }; class reload_ammobelt_hide: magazine_hide { selection="ammo_belt"; }; class reload_ammobelt_bottom_hide: magazine_hide { selection="ammo_belt_bottom"; }; class ammobelt_hide: magazine_hide { source="isEmpty"; selection="ammo_belt"; minValue=0.000000; maxValue=1.000000; hideValue=1.000000; }; class ammobelt_bottom_hide: ammobelt_hide { selection="ammo_belt_bottom"; }; /// Hiding of magazine if weapon has none class no_magazine { type="hide"; source="hasMagazine"; selection="magazine"; minValue=0.000000; maxValue=1.00000; hideValue=0.5; unhideValue = -1.0; }; }; }; class Rifle: Weapon { skeletonName="Rifle"; class Animations: Animations { class magazine_hide:magazine_hide { sourceAddress="mirror"; minValue=0.0; maxValue=0.56; hideValue=0.36; }; class bolt_empty { type="translation"; source="isEmpty"; selection="bolt"; axis="bolt_axis"; memory=1; minValue=0.000000; maxValue=0.500000; offset0=0; offset1=0.5; }; class bullet_cover { type="rotation"; source="reload"; sourceAddress="mirror"; selection="bullet_cover"; axis="bullet_cover_axis"; memory=1; minValue=0.0; maxValue=0.5; angle0=0; angle1=-0.4; }; class bolt_fire_begin { type="translation"; source="reload"; selection="bolt"; axis="bolt_axis"; memory=1; minValue=0.000000; maxValue=0.300000; offset0=0; offset1=0.5; }; class bolt_fire_end:bolt_fire_begin { minValue=0.500000; maxValue=1.000000; offset0=0; offset1=-0.5; }; class bolt_reload_begin { type="translation"; source="reloadMagazine"; selection="bolt"; axis="bolt_axis"; memory=1; minValue=0.1; maxValue=0.15; offset0=0; offset1=0.5; }; class bolt_reload_end:bolt_reload_begin { minValue=0.980000; maxValue=1.000000; offset0=0; offset1=-0.5; }; }; }; class Test_WeaponBase: Rifle { skeletonName = "Test_Weapon"; sectionsInherit = ""; sections[] = {"muzzleFlash","Camo"}; class Animations { class trigger /// not in this model, but good to use { type = "rotation"; source = "reload"; sourceAddress = "clamp"; selection = "trigger"; axis = "trigger_axis"; minValue = 0; maxValue = "1"; angle0 = "0"; angle1 = "rad -30"; }; class bolt { type = "translation"; source = "reload"; sourceAddress = clamp; selection = "bolt"; axis = "bolt_axis"; minValue = 0.5; maxValue = 1; offset0 = 0; offset1 = 0.3; }; class bolt_2: bolt { minValue = 0; maxValue = 0.5; offset0 = 0; offset1 = 0.7; }; class bolt_empty: bolt{ source = "isEmptyNoReload"; minValue = 0; maxValue = 1; offset0 = 0; offset1 = 1; }; class bolt_reload_move_1: bolt_empty { source="reloadMagazine"; // z: should work like that only if weapon is empty minValue=0; maxValue=0.00001; }; class bolt_reload_move_2: bolt_reload_move_1 { source="reloadMagazine"; // z: should work like that only if weapon is empty minValue=0.78; maxValue=0.80; offset1 = -1; }; class bolt_catch: bolt { selection = "bolt_catch"; axis = "bolt_catch_axis"; }; class bolt_catch_2: bolt_2 { selection = "bolt_catch"; axis = "bolt_catch_axis"; }; class bolt_catch_empty: bolt_empty { selection = "bolt_catch"; axis = "bolt_catch_axis"; }; class bolt_catch_reload_move_1: bolt_reload_move_1 { selection = "bolt_catch"; axis = "bolt_catch_axis"; }; class bolt_catch_reload_move_2: bolt_reload_move_2 { selection = "bolt_catch"; axis = "bolt_catch_axis"; }; class magazine_hide { type="hide"; source="reloadMagazine"; selection="magazine"; minValue=0.000000; maxValue=1.00000; hideValue=0.188; unhideValue = 0.550; }; class no_magazine { type="hide"; source="hasMagazine"; selection="magazine"; minValue=0.000000; maxValue=1.00000; hideValue=0.5; unhideValue = -1.0; }; class magazine_reload_move_1 { type = "translation"; source = "reloadMagazine"; selection = "magazine"; axis = "magazine_axis"; minValue = 0.145; maxValue = 0.170; offset0 = 0.0; offset1 = 0.5; }; class magazine_reload_move_2: magazine_reload_move_1 { minValue = 0.573; maxValue = 0.602; offset0 = 0.0; offset1 = -0.5; }; class muzzleFlashROT { type="rotationX"; source="ammoRandom"; //use ammo count as phase for animation sourceAddress="loop"; //loop when phase out of bounds selection="muzzleFlash"; //selection we want to rotate axis=""; //no own axis - center of rotation is computed from selection centerFirstVertex=true; //use first vertex of selection as center of rotation minValue=0; maxValue=4; //rotation angle will be 360/4 = 90 degrees angle0="rad 0"; angle1="rad 360"; }; class OP_ROT { type="rotation"; source="zeroing2"; // use second muzzle zeroing for rotation sourceAddress="loop"; // loop when phase out of bounds selection="OP"; // selection we want to rotate axis="OP_axis"; // has its own axis minValue=0; maxValue=3; angle0="rad 0"; angle1="rad 65"; }; class BackSight_optic { type="rotation"; source="hasOptics"; selection="BackSight"; axis="BackSight_axis"; memory=1; minValue=0.0000000; maxValue=1.0000000; angle0=0.000000; angle1=(rad 90); }; class ForeSight_optic: BackSight_optic { selection="ForeSight"; axis="ForeSight_axis"; angle1=(rad 90); }; // Rotation of fire mode switch class safety_mode_rot { type = rotation; source = weaponMode; selection = "safety"; axis = "safety_axis"; memory = 1; minValue = 0; maxValue = 0.25; angle0 = 0; angle1 = (rad -52); }; }; }; class CAT_thompson1921_stick: Test_WeaponBase {}; }; I used the model.cfg from the sample, and replace the last class with my weapon name. Share this post Link to post Share on other sites
p1nga 23 Posted August 5, 2014 How to animate a bolt moving? I have looked at the sample file, added my own bolt_axis points. }; I used the model.cfg from the sample, and replace the last class with my weapon name. Did you also create the Named Selection, 'Bolt' so that the animation knows what part of the model to animate along the axis? Share this post Link to post Share on other sites
alleycat 28 Posted August 5, 2014 Yes, the selection was already existing because it is a separate object. ---------- Post added at 04:40 PM ---------- Previous post was at 03:16 PM ---------- Do I have to manually create a selection in O2? Because the fbx import already made every object a separate selection with the name. And is there something wrong in my model.cfg? Share this post Link to post Share on other sites
PolyG 69 Posted August 5, 2014 Do you have the bolt_axis? Share this post Link to post Share on other sites
alleycat 28 Posted August 5, 2014 Yes, consisting of 2 points Share this post Link to post Share on other sites
alleycat 28 Posted August 5, 2014 This is the p3d setup: Share this post Link to post Share on other sites
Alwarren 2767 Posted August 7, 2014 Hm, you have skeletonName="Weapon"; in your model, but your CfgSkeleton only defines Test_Weapon. Unless you have another model.cfg in your root, you are not using a defined skeleton, which will probably be the issue. Share this post Link to post Share on other sites
alleycat 28 Posted August 7, 2014 How would I fix this? And why is that happening on a default model.cfg supplied with the sample files? Share this post Link to post Share on other sites
da12thMonkey 1943 Posted August 7, 2014 (edited) How would I fix this? And why is that happening on a default model.cfg supplied with the sample files? Because the model.cfg in the samples provides an example of how to set up inheritances in the weapon's model.cfg between different model classes so that you can use common animation elements on a number of different models. i.e If you have a dozen different models and they all have the same basic animation for say: a magazine that hides when the weapon is unloaded, a muzzle flash that appears and disappears when fired etc. you don't want to repeat writing those exact same animations for every model you make, when you write them once and inherit them in every model's class It contains a parent class Weapon which uses an implied "weapon" skeleton a class Rifle: Weapon which inherits from this class Weapon, and uses another implied skeleton called "rifle" and finally the actual class that defines the animations for the test weapon model, class Test_WeaponBase which does use the actual "Test_Weapon" skeleton written at the head of the model.cfg. The test model itself test_weapon_01_F.p3d is defined to inherit all these properties throughout the entire inheritance tree in the last line: class Test_weapon_01_F: Test_WeaponBase {}; Note that the classname matches the .p3d name here. It doesn't contain any parameters like skeletonName = "Test_Weapon"; because it will inherit that directly from the previous class in the tree, but not the 'Rifle' and 'Weapon' skeletons because they were overwritten. It'd probably make more sense if they included the other skeletons in the top cfgskeletons section as well, but they're not actually used by the example model, and the skeletonBones[] = array has to be written for each individual class unless they share all the same bones anyway (i.e the array can't be inherited and just add the additional bones added with each subclass) so the skeletons would probably all look the same anyway. Edited August 7, 2014 by da12thMonkey Share this post Link to post Share on other sites
alleycat 28 Posted August 7, 2014 I dont get why this often praised inheritance is supposed to "save work" when all it does is eat time because people have to trace the inheritance tree to get what they want + loads of crashes from improperly inherited classes. I rather have one list of 500 parameters in one bracket and edit this per weapon. This would actually have saved much more time. But to get back to the problem I have, while your explanation was very useful to understand the model.cfg I am still not getting why my model does not connect to it. Share this post Link to post Share on other sites
Macser 776 Posted August 7, 2014 I dont get why this often praised inheritance is supposed to "save work" What? :) Without the use of inheritance,you'd have to restate each individual class,in it's entirety. Considering the size of some of them,it takes a lot of the tedium out of configs,by stripping away anything which does not change,in the inheriting class.Saving time and making a neater, smaller,config file. Share this post Link to post Share on other sites
alleycat 28 Posted August 7, 2014 Well for me it looks like some overengineered programmers geeking out. As an artist I find it tiring having to worry how to make use of this correctly. Having 500 parameters in one large bracket is more managable than running down an inheritance tree and tripping over shit all the time. Something beind defined again in a child class? So what? Stuff being defined all the time double is still a faster workflow than carefully picking through the inheritance. Isnt the asset workflow supposed to be made accessible to artists? Share this post Link to post Share on other sites
da12thMonkey 1943 Posted August 7, 2014 It takes time to learn it but after you spend a lot of time reasing configs and stuff you often end up with a good idea of what base classes to search for for particular values. Also it allows you to change the behaviour of all subclasses in that tree with one single value rather than go through every class changing it manually - great for writing replacement mods and other things. Is your model file actually called CAT_thompson1921_stick.p3d? I don't mean the classname in the config.cpp I mean the actual 3D model file. If it isn't you either need to rename the .p3d to that, or change that part of the model.cfg to match the current .p3d filename. The model.cfg itself seems to check out okay on first inspection - mismatching the filename with the cfgmodels class is the only thing that immediately springs to mind. Share this post Link to post Share on other sites
alleycat 28 Posted August 7, 2014 The p3d file is: cat_thompson_stick.p3d Share this post Link to post Share on other sites
Macser 776 Posted August 7, 2014 (edited) The actual P3d name must match the name stated in the model.cfg. In your CfgModels section you have: class CAT_thompson1921_stick: Test_WeaponBase {}; Try: class cat_thompson_stick: Test_WeaponBase {}; Edited August 7, 2014 by Maczer Share this post Link to post Share on other sites
alleycat 28 Posted August 7, 2014 Thanks for the help, however this did not work either. Can I be sure the problem lies with the model.cfg and not on the p3d? Is there a simple way to see if the model.cfg is even read? I have other weird behaviour in the gun, for example, no muzzle flash but smoke sprites and the actual bullets do spawn. Also casings are only visible in 3rd person. I will post my config: /* Thompson M1921 created by cat */ #include "basicdefines_A3.hpp" class CfgPatches { class CAT_thompson1921 { units[]={}; weapons[]={"CAT_thompson1921_stick"}; requiredVersion=0.1; requiredAddons[]={"A3_Weapons_F"}; }; }; /// All firemodes, to be sure class Mode_SemiAuto; class Mode_Burst; class Mode_FullAuto; /// Weapon slots class SlotInfo; class CowsSlot; class PointerSlot; #include "cfgRecoils.hpp" /// specific recoil patterns for this rifle #include "cfgMagazines.hpp" /// specific magazines for this rifle #include "cfgAmmo.hpp" /// specific ammo for this rifle class CfgWeapons { //Inheritance class Default {}; class RifleCore: Default {}; class Rifle: RifleCore {}; class Rifle_Base_F: Rifle { class WeaponSlotsInfo; class GunParticles; }; class SMG_01_Base: Rifle_Base_F {}; class SMG_01_F: SMG_01_Base {}; class CAT_thompson1921_stick: SMG_01_F { descriptionshort = "Submachine Gun<br />Caliber: .45 ACP"; dexterity = 100; displayname = "Thompson M1921 (20Rnd Stick)"; model = "cat_thompson\p3d\cat_thompson_stick.p3d"; picture = "\A3\Weapons_F_beta\Smgs\SMG_01\data\UI\gear_SMG_01_X_CA.paa"; scope = 2; uipicture = "\A3\Weapons_F\data\UI\icon_regular_CA.paa"; //handanim[] = {"OFP2_ManSkeleton", "\A3\Weapons_F_beta\rifles\mk20\data\Anim\mk20.rtm"}; handanim[] = {"OFP2_ManSkeleton", "cat_thompson\anim\cat1.rtm"}; memorypointcamera = "eye"; modelOptics = "-"; reloadaction = ""; modes[] = {"Single", "FullAuto"}; // Size of recoil sway of the cursor maxRecoilSway=0.0125; // Speed at which the recoil sway goes back to zero (from maxRecoilSway to 0 in 1/swayDecaySpeed seconds) swayDecaySpeed=1.25; /* class WeaponSlotsInfo: WeaponSlotsInfo { mass = 60; }; */ class Library { libtextdesc = "$str_a3_cfgweapons_hgun_smg_01_library0"; }; }; }; // I cloned the vermin and overwrote the parts I wanted to change, perhaps something broke in here. Share this post Link to post Share on other sites
Alwarren 2767 Posted August 7, 2014 I still think the skeleton name is wrong... Share this post Link to post Share on other sites
alleycat 28 Posted August 7, 2014 Is the skeleton name soem secret name that is somewhere in the arma3 files? Zachs tutorial skeleton looks like this: class CfgSkeletons { class Default { isDiscrete=1; skeletonInherit=""; skeletonBones[]={}; }; class tb_arifle_m16a4_base: Default { skeletonBones[]= { "magazine", "", "bolt", "" }; }; }; class CfgModels { class Default { sectionsInherit=""; sections[]={}; skeletonName=""; }; class tb_arifle_m16a4_base: Default { sections[]= { "magazine", "bolt" }; skeletonName="tb_arifle_m16a4_base"; class Animations { }; }; class hkump45: tb_arifle_m16a4_base { class Animations { class magazine_reload_move_1 { type="translation"; source="reloadMagazine"; selection="magazine"; axis="magazine_axis"; minValue=0.145; maxValue=0.2; offset0=0; offset1=0.40000001; }; class magazine_hide { type="hide"; source="reloadMagazine"; selection="magazine"; minValue= 0; maxValue=1; minPhase= 0; maxPhase=1; hideValue=1; sourceAddress="mirror"; }; class bolt_empty { type="translation"; source="isempty"; selection="bolt"; memory=1; sourceAddress="clamp"; minValue=0; maxValue=1; begin="bolt_start"; end="bolt_end"; offset0=0; offset1=1; }; class bolt_empty_1 { type="translation"; source="reloadMagazine"; selection="bolt"; memory=1; sourceAddress="clamp"; minValue=0; maxValue=1; begin="bolt_start"; end="bolt_end"; offset0=0; offset1=1; }; }; }; }; Which uses skeletonName="tb_arifle_m16a4_base"; which at this point is just random names of things someone got from somewhere. Share this post Link to post Share on other sites
da12thMonkey 1943 Posted August 7, 2014 You can call the skeleton whatever you like - you don't have have to call it 'weapon', 'rifle', 'test weapon' or any other name used in the BIS example. So long as the skeletonName=""; entry for your model refers to the exact name you've chosen for the cfgskeletons class, it will use that skeleton. Looking at this pic you posted: http://i.imgur.com/XBbLnge.jpg Do all four of those verts/mem points belong to the bolt_axis or bolt_catch_axis selection? An axis should only contain two vertices/mem points maximum. The axis is formed by the imaginary line between two points. If they have more than two points, things get a little screwed up You might also need to check that the parts of your mesh that make up the 'bolt' selection, aren't also part of another selection like 'bolt_catch' or 'receiver'. You link different parts of the model together using the skeleton, so there's no reason to include them in more than one named selection. Dunno if you know this already, but you can check the model.cfg in buldozer without compiling the addon into a .pbo and playing it ingame. When you load the model in buldozer and press [Enter] you should see little text strings appearing in the top right that contain the animation source names that are defined for that model in your model.cfg. If you then press [[] it'll change the animation phase of the source you selected by pressing [Enter] and you should see the model performing that animation (pressing []] will cycle the phase backwards). If the animation source names don't show up, it's a problem with how the model.cfg is set up. If the names show up but the model doesn't perform the animation it's probably the model selections that aren't set up right. Share this post Link to post Share on other sites
alleycat 28 Posted August 7, 2014 Th top row of points is the bolt_catch axis and the row below is bolt_axis. And I added a copy of the boly object and named it just to cover both bolt and bolt axis. The objects are just their own named selection. I cant use the bulldozer because it never boots, crashes ever y time with an external viewer error ---------- Post added at 09:18 PM ---------- Previous post was at 07:32 PM ---------- Ok got the dozer to run (it throws a few errors but the model shows) and when pressing enter it only shows ANIM in the top left but nothing else. So I assume its the model.cfg Share this post Link to post Share on other sites